/// <summary> /// 入力ログファイルを指定して,インスタンスを初期化します. /// </summary> /// <param name="inputLogFile">入力のログファイル</param> /// <param name="shellHook">シェルフックウィンドウ</param> /// <param name="config">設定</param> public UserInputWindow(string inputLogFile, ShellHookWindow shellHook, UserInputConfig config) { _logFile = inputLogFile; _shellHook = shellHook; _config = config; shellHook.WindowActivated += shellHook_WindowActivated; InitializeComponent(); // フックの開始 _hookProc = HookCallback; // アンマネージに渡すデリゲートのライフタイムは自分で管理する! _hHook = User.SetWindowsHookEx(WindowsHook.KeyboardLL, _hookProc, IntPtr.Zero, 0); }
public static extern int SetWindowsHookEx(int idHook, WindowsHookProc lpfn, IntPtr hInstance, int threadId);
public static extern IntPtr SetWindowsHookEx(int idHook, WindowsHookProc lpfn, IntPtr hMod, int dwThreadId);
internal static extern int SetWindowsHookEx(int idHook, WindowsHookProc lpfn, IntPtr hInstance, int threadId);
public static extern IntPtr SetWindowsHookEx(int hookType, WindowsHookProc hookProc, IntPtr module, uint threadId);
public static extern IntPtr SetWindowsHookEx(int idHook, WindowsHookProc lpfn, IntPtr hMod, uint dwThreadId);