RegisterDeviceNotification

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr RegisterDeviceNotification(
   IntPtr hRecipient,
   IntPtr NotificationFilter,
   uint Flags
);

Microsoft documentation: Link

Last updated