If new drive detected.. an event happens
-
I am trying to create an application where, if new drive has been detected by the windows operating system, an event on the application is triggered. Although what i was planning to do is the application to check for new drives in a given time interval but seems like that is not the appropriate thing to do. Any suggestions?
-
I am trying to create an application where, if new drive has been detected by the windows operating system, an event on the application is triggered. Although what i was planning to do is the application to check for new drives in a given time interval but seems like that is not the appropriate thing to do. Any suggestions?
-
I am trying to create an application where, if new drive has been detected by the windows operating system, an event on the application is triggered. Although what i was planning to do is the application to check for new drives in a given time interval but seems like that is not the appropriate thing to do. Any suggestions?
Hi, for a Control (a Form is a Control) you can override WndProc and check for wParam==WM_DEVICECHANGE That will give you an event whenever a device (such as a camera, USB memory stick, ...) gets added or removed. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
-
I am trying to create an application where, if new drive has been detected by the windows operating system, an event on the application is triggered. Although what i was planning to do is the application to check for new drives in a given time interval but seems like that is not the appropriate thing to do. Any suggestions?
Try responding to the WM_DEVICECHANGE[^] window message. A WParam value of DBT_DEVICEARRIVAL[^] should indicate a new cd/usb drive. Will probably only work if you have auto insert notification turned on for the drive. [Edit: Oops, should have hit refresh before posting. I agree with Luc]
Simon