WM 6.0 CF ActivateDevice API call problem

R

rgmullen

I have an application that has run swimmingly for a couple years on
previous version of WM. This application uses MSMQ heavily which has
not been a problem until this version of WM. In the past I did not
need to use API calls as I believe that MSMQ ran under its own
context. Now I find it necessary to make a call to ActivateDevice()
with the driver location as per the blogs for MSMQ on this version.
All is well and good, that part works just fine and I follow it with a
call to CloseHandle with returned pointer. Again, no problem that I
can see as this succeeds or at very least does not return a WinError.
The problem is that the code I have that follows goes off and sets up
variables, control state, etc. As soon as I reference a form control
the application crashes though. It only does this the first time after
a warm boot though. Subsequent passes do not crash. I have tried doing
the ActivateDevice on its own thread and nothing changes. I have
removed the CloseHandle call thinking maybe it is closing something
other than what it should (dunno how that would happen though) but the
crash persists. The only thing that prevents the crash is removing the
entire call (ActivateDevice and CloseHandle) but that is my mechanism
for starting MSMQ. Any idea what might be going on here?

TIA
 
R

rgmullen

I have an application that has run swimmingly for a couple years on
previous version of WM. This application uses MSMQ heavily which has
not been a problem until this version of WM. In the past I did not
need to use API calls as I believe that MSMQ ran under its own
context. Now I find it necessary to make a call to ActivateDevice()
with the driver location as per the blogs for MSMQ on this version.
All is well and good, that part works just fine and I follow it with a
call to CloseHandle with returned pointer. Again, no problem that I
can see as this succeeds or at very least does not return a WinError.
The problem is that the code I have that follows goes off and sets up
variables, control state, etc. As soon as I reference a form control
the application crashes though. It only does this the first time after
a warm boot though. Subsequent passes do not crash. I have tried doing
the ActivateDevice on its own thread and nothing changes. I have
removed the CloseHandle call thinking maybe it is closing something
other than what it should (dunno how that would happen though) but the
crash persists. The only thing that prevents the crash is removing the
entire call (ActivateDevice and CloseHandle) but that is my mechanism
for starting MSMQ. Any idea what might be going on here?

TIA

I had used .NET CF 2.0 sp2 on this project thinking the fixes might
make a difference and I remember seeing some threading-handle issues.
No good. Just today I decided to give a go at CF v3.5 even though I am
only using 2.0 features. Lo and behold the problem has gone away.
Definitely a bug. Hope this helps someone else.
 

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