This is a may be reached through AutoHotkey.dll (that has COM Interface).
You to need download this library, move in c:\Windows\System32
.
And register for the system (Run, % "regsvr32.exe AutoHotkey.dll"
, % "c:\Windows\System32")
.
Then in VS create a console application project, and choose Project tab/Add reference.
In opened window find AutoHotkey library, click on "Add" button, then close the window.
So now you have connected this library in your project, and this you'll see in reference folder.
Select all in Program.cs and replace on this code:
using System.Threading;
using AutoHotkey;
namespace work_with_AHK_object
{
class Program
{
static void Main()
{
/// write content for ahk script (thread)
string scriptContent=""
//+"#NoTrayIcon\n"
+"#KeyHistory, 0\n"
+"#NoEnv\n"
//+"ListLines, Off\n"
//+"DetectHiddenWindows, On\n"
//+"Process, Priority,, High\n"
+"SetBatchLines, -1\n"
+"SetMouseDelay, 25\n"
//+"Menu, Tray, Icon, % \"shell32.dll\", -153\n"
//+"WinSet, AlwaysOnTop, On, % \"ahk_id\"A_ScriptHwnd\n"
//+"WinSet, Style, -0xC00000, % \"ahk_id\"A_ScriptHwnd\n"
//+"WinMove, % \"ahk_id\"A_ScriptHwnd,, 888, 110, 914, 812\n"
//+"ListLines\n"
//+"ListLines, On\n"
+"TrayTip,, % \"Ready to use!\"\n" /// some notice
+""
+"Ins::\n"
+" Suspend\n"
+" Loop, % A_IsSuspended ? 1:2\n"
+" SoundBeep, 12500, 50\n"
+" KeyWait, % A_ThisHotkey\n"
+" Return\n"
+""
+"LButton::\n"
+" Loop\n"
+" Send, {Click}\n"
+" Until, !GetKeyState(\"LButton\", \"P\")\n"
+" Return\n"
+""
+"Space::\n"
+" Suspend, Off\n"
+" ExitApp";
/// initialize instance
CoCOMServer ahkThread=new CoCOMServer();
/// launch a script in a separate thread
ahkThread.ahktextdll(scriptContent);
/// wait for exit
while (ahkThread.ahkReady()!=0) Thread.Sleep(1000);
}
}
}
Open project property, in Application tab change it Output type to Windows Application.