Device Notify window (RegisterDeviceNotification)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm writing a C# application, this application will display a message when
USB device connected/disconnected(removed) , How can I do that ?
I made some research and find something called "RegisterDeviceNotification"
, But don't find how to use it in my C# since I should send to this API
"IntPtr hRecipient", How can I do that ?

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

I saw some example in C++ which do the following :
RegisterDeviceNotification(this->GetSafeHwnd(), &NotificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE);

How to do the same in C# ?????????????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top