I am writing a C class library for a WPF application. The class library should raise an event whenever some USB device is plugged in/plugged out. I am. 【補足】 RegisterDeviceNotification の 2nd parameter について. 2nd parameter は、 LPVOID 型といっても、上記ドキュメントの以下. I have a service that uses RegisterDeviceNotification to watch for changes with mounted drives. The process is as follows:- A user-mode application to detect hardware add/remove with WM_DEVICECHANGE and RegisterDeviceNotification(); Author: Sam NG; Updated: 19 Jun 2006; Section. registerdevicenotification (user32). Summary. static extern IntPtr RegisterDeviceNotification(IntPtr hRecipient, IntPtr NotificationFilter, uint Flags); Check for device change (add/remove) events. Marshal.StructureToPtr(dbi, buffer, true); notificationHandle = RegisterDeviceNotification(windowHandle. I currently have some code that sets up notifications of connected USB HID devices within a Windows Service (written in C++). The code is as follows: GUID hidGuid. HDEVNOTIFY WINAPI RegisterDeviceNotification. Services can use the RegisterDeviceNotification function to register to receive device notifications. See Also Device Management Functions Device Notifications BroadcastSystemMessage HandlerEx RegisterDeviceNotification UnregisterDeviceNotification DEV_BROADCAST_HDR Applications can use the RegisterDeviceNotification function to register to receive notification messages from the system. The following example shows how.