-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
king.nakama
committed
Sep 20, 2022
1 parent
e76bc0f
commit a33101d
Showing
10 changed files
with
109 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using NClicker.Services; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace NClicker.Helpers | ||
{ | ||
public class Win32KernelApi | ||
{ | ||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)] | ||
public static extern IntPtr LoadLibrary(string lpFileName); | ||
|
||
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] | ||
public static extern bool FreeLibrary(IntPtr hModule); | ||
|
||
/// <summary> | ||
/// The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. | ||
/// You would install a hook procedure to monitor the system for certain types of events. These events are | ||
/// associated either with a specific thread or with all threads in the same desktop as the calling thread. | ||
/// </summary> | ||
/// <param name="idHook">hook type</param> | ||
/// <param name="lpfn">hook procedure</param> | ||
/// <param name="hMod">handle to application instance</param> | ||
/// <param name="dwThreadId">thread identifier</param> | ||
/// <returns>If the function succeeds, the return value is the handle to the hook procedure.</returns> | ||
[DllImport("USER32", SetLastError = true)] | ||
public static extern IntPtr SetWindowsHookEx(int idHook, GlobalKeyboardService.HookProc hookProc, IntPtr hMod, int dwThreadId); | ||
/// <summary> | ||
/// The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function. | ||
/// </summary> | ||
/// <param name="hhk">handle to hook procedure</param> | ||
/// <returns>If the function succeeds, the return value is true.</returns> | ||
[DllImport("USER32", SetLastError = true)] | ||
public static extern bool UnhookWindowsHookEx(IntPtr hHook); | ||
|
||
/// <summary> | ||
/// The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. | ||
/// A hook procedure can call this function either before or after processing the hook information. | ||
/// </summary> | ||
/// <param name="hHook">handle to current hook</param> | ||
/// <param name="code">hook code passed to hook procedure</param> | ||
/// <param name="wParam">value passed to hook procedure</param> | ||
/// <param name="lParam">value passed to hook procedure</param> | ||
/// <returns>If the function succeeds, the return value is true.</returns> | ||
[DllImport("USER32", SetLastError = true)] | ||
public static extern IntPtr CallNextHookEx(IntPtr hHook, int code, IntPtr wParam, IntPtr lParam); | ||
|
||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using NClicker.Services; | ||
using System.ComponentModel; | ||
|
||
namespace NClicker.Models | ||
{ | ||
public class GlobalKeyboardHookEventArgs : HandledEventArgs | ||
{ | ||
public GlobalKeyboardService.KeyboardState KeyboardState { get; } | ||
public GlobalKeyboardService.LowLevelKeyboardInputEvent KeyboardData { get; } | ||
|
||
public GlobalKeyboardHookEventArgs(GlobalKeyboardService.LowLevelKeyboardInputEvent keyboardData, | ||
GlobalKeyboardService.KeyboardState keyboardState) | ||
{ | ||
KeyboardData = keyboardData; | ||
KeyboardState = keyboardState; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters