I'm looking at the RegisterHotKey Function:
http://msdn.microsoft.com/en-us/library/ms646309(VS.85).aspx
BOOL RegisterHotKey(
__in HWND hWnd,
__in int id,
__in UINT fsModifiers,
__in UINT vk
);
I've been using IntPtr
to pass in the first argument, which works fine in most cases. But now I need to deliberately pass a null pointer as the first argument, which IntPtr
(deliberately) will not do. I'm new to .Net, and this has me perplexed. How can I do this?
Use IntPtr.Zero
for NULL
For example:
public void Example() {
...
RegisterHotKey(IntPtr.Zero, id, mod, vk);
}
[DllImportAttribute("user32.dll", EntryPoint="RegisterHotKey")]
[return: MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern bool RegisterHotKey(
IntPtr hWnd,
int id,
uint fsModifiers,
uint vk);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With