USB Flash memory arrive/remove notification

Status
Not open for further replies.
Hi everybody,

I'm developing a application to run over Windows XP embedded and have some troubles with
the usb flash memory handling.

My application needs to do some job when a USB flash memory is Removed/Inserted in any

available USB port.

I am using the Windows Messages WM_DEVICECHANGE with the flags DBT_DEVICEARRIVAL and

DBT_DEVICEREMOVECOMPLETE. It works very well after the the usb flash memory has been used in

the computer where the application run.

But, When the application is running and a flash memory is inserted by first time in the

computer, Windows sends the WM_DEVICECHANGE-DBT_DEVICEARRIVAL followed by a WM_DEVICECHANGE

-DBT_DEVICEREMOVECOMPLETE and other WM_DEVICECHANGE-DBT_DEVICEARRIVAL. In this case, the

behavior of the application is apparently wrong because it process the Device Remove message

and the flash memory is still inserted in the USB Port.

Is there any diference between the WM_DEVICECHANGE-DBT_DEVICEARRIVAL message sent by Windows

the first time that a flash memory is inserted in a computer?

Does anyone know how to identify this first WM_DEVICECHANGE-DBT_DEVICEARRIVAL?

I have another issue, sometimes take few seconds to detect the WM_DEVICECHANGE-

DBT_DEVICEARRIVAL or WM_DEVICECHANGE-DBT_DEVICEREMOVECOMPLETE. is this a isolated issue or

any of you have seen something like that?

Thanks for any help
 
Status
Not open for further replies.
Back