using System; using System.Runtime.InteropServices; namespace Gma.System.MouseKeyHook.WinApi { internal static class HotkeysNativeMethods { /// /// Defines a system-wide hot key. /// /// /// A handle to the window that will receive WM_HOTKEY messages generated by the hot key. If this parameter is NULL, /// WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop. /// /// /// The identifier of the hot key. If the hWnd parameter is NULL, then the hot key is associated with the current /// thread rather than with a particular window. If a hot key already exists with the same hWnd and id parameters, see /// Remarks for the action taken. /// /// /// The keys that must be pressed in combination with the key specified by the uVirtKey parameter in order to generate /// the WM_HOTKEY message. The fsModifiers parameter can be a combination of the following values. /// /// /// The virtual-key code of the hot key. See Virtual Key Codes. /// /// /// If the function succeeds, the return value is nonzero. /// If the function fails, the return value is zero. To get extended error information, call GetLastError. /// [DllImport("user32.dll")] public static extern int RegisterHotKey(IntPtr hwnd, int id, int fsModifiers, int vk); /// /// Frees a hot key previously registered by the calling thread. /// /// /// A handle to the window associated with the hot key to be freed. This parameter should be NULL if the hot key is not /// associated with a window. /// /// /// The identifier of the hot key to be freed. /// /// /// If the function succeeds, the return value is nonzero. /// If the function fails, the return value is zero. To get extended error information, call GetLastError. /// [DllImport("user32.dll")] public static extern bool UnregisterHotKey(IntPtr hwnd, int id); } }