User32RegisterHotKey(IntPtr, Int32, UInt32, UInt32) Method

Defines a system-wide hotkey.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static bool RegisterHotKey(
	IntPtr hWnd,
	int id,
	uint modifiers,
	uint vKey
)

Parameters

hWnd  IntPtr
A handle to the window that will receive WM_Hotkey messages generated by the hot key.

If this parameter is Zero, WM_Hotkey messages are posted to the message queue of the calling thread and must be processed in the message loop.

id  Int32
The identifier of the hotkey.

If the hwnd parameter is 0, then the hotkey is associated with the current thread rather than with a particular window.

If a hotkey already exists with the same hWnd and id parameters, see Remarks for the action taken.

modifiers  UInt32
The keys that must be pressed in combination with the key specified by the vKey parameter in order to generate the WM_Hotkey message.
vKey  UInt32
The virtual-key code of the hotkey.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also