Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi

i need code for detect insertion of USB stick using c#

thanx
Posted

You have to handle DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE and DBT_DEVICEREMOVECOMPLETE message for handling USB device arrival and removal events. You can get related source code from Detecting USB Drive Removal in a C# Program[^]
 
Share this answer
 
Comments
Oshtri Deka 29-Feb-12 8:41am    
5
Here's a great example:

http://www.expertcore.org/viewtopic.php?t=1472[^]

Regards
 
Share this answer
 
Comments
Oshtri Deka 29-Feb-12 8:42am    
5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900