not receiving WM_DEVICECHANGE-DBT_DEVICEARRIVAL

E

Erwin Hill

Hi guys,

I have a weird problem.
I wrote an application that has 2 UI threads both windows
are top-level. When I insert my USB disk on key into
computer I receive several WM_DEVICECHANGE which are sent
trough PostMessage and WM_DEVICECHANGE with wParam set to
DBT_DEVICEARRIVAL and this one is sent to me through
SendMessage(by windows) I checked this through Spy++(I
don't know why last one is sent through SendMessage). The
intention of program is to write that it detected
insertation of USB disk on key and it works fine, BUT if
main UI thread is in state that it doesn't pump its
message queue some kind of long processing, and I insert
USB disk on key into the computer , the second UI thread
that DOES pump messages gets several WM_DEVICECHANGE
notification but it NEVER receives the one with wParam
DBT_DEVICEARRIVAL. This happens as I mentioned only when
the main thread is in some busywait state but second UI
thread is also top level windows so I don't see any reason
I don't get DBT_DEVICEARRIVAL.

Thanks in advance
 
R

Ray Yang

try DBT_DEVNODES_CHANGED

I've ever met the same situation and found my thread can receive this one.

--

Regards,
Ray [@ Sydney]
Windows Driver Developer/Service
[Remove 'stopspam' & 'nospam' when you send email to me]
 

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

Top