-
February 8th, 2006, 12:01 PM
#1
USB Flash memory arrive/remove notification
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
-
February 8th, 2006, 01:52 PM
#2
Geezer
Originally Posted by gcfreddy
..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?..
Yup, the plug & play service will have fired & be busy trying to check if its got drivers etc..
& if I remember my windows api programming experience correctly, that means the usb card gets marked as removed until the plug & play service reports 'approval' ..
This is something you might just have to 'live with' & maybe the simplest answer is just programming in a pause, rather than doing whatever methods are needed to check everything is ok at that very precise moment ?
Similar Threads
-
By bwbeye in forum USB/Firewire
Replies: 1
Last Post: April 10th, 2006, 10:55 AM
-
By TechZ in forum Windows XP
Replies: 1
Last Post: April 8th, 2005, 07:32 AM
-
By Marinero in forum USB/Firewire
Replies: 14
Last Post: May 8th, 2004, 07:23 AM
-
By jaeger in forum Tech Lounge & Tales
Replies: 17
Last Post: June 20th, 2002, 04:48 PM
-
By Venus in forum Windows 95/98/98SE/ME
Replies: 2
Last Post: June 11th, 2001, 05:53 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks