baykovr / AVPI

an open source voice command macro software
https://baykovr.github.io/gavpi.html
GNU General Public License v3.0
198 stars 42 forks source link

InputManager.dll .NET 4.0+ fix #51

Closed AmethystAir closed 8 years ago

AmethystAir commented 8 years ago

I patched InputManager to work with .NET 4.0; There shouldn't be any more OverflowExceptions thrown from InstallHook() calls.

AmethystAir commented 8 years ago

I've renamed "PressOnce" to "Toggle" to more accurately represent what it does, as well as added a "Single" mode which recognizes one voice command after the key is pressed then stops.

AmethystAir commented 8 years ago

42 is fixed by the latest commit.

baykovr commented 8 years ago

Thanks for the fix,

Verified InputManager, diff: InstallHook() - KeyboardHook.KeyHook = KeyboardHook.SetWindowsHookEx(13, KeyboardHook.KeyHookDelegate, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]).ToInt32(), 0); + KeyboardHook.KeyHook = KeyboardHook.SetWindowsHookEx(13, KeyboardHook.KeyHookDelegate, 0, 0);

Debug hooks got baked in, don't think they will cause any problems...

Which tool did you use? Need to apply the same change to MouseHook.cs InputManager.MouseHook.MouseHook = InputManager.MouseHook.SetWindowsHookEx(14, InputManager.MouseHook.MouseHookDelegate, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]).ToInt32(), 0);

AmethystAir commented 8 years ago

I just downloaded the source from the InputManager site and used Visual Studio to fix it. If I remember, the one I committed included the fixed mouse hooks (I noticed it after double checking the code) but not the one I zipped and uploaded. If it isn't fixed in the one I committed I can re-upload without debug hooks.