skin
asked on
Closing while in DoEvents causes exception
I'm a VC programmer that used VB to create a control to embed in my MFC MDI Application. I am getting an unhandled exception when I close my MFC application while my VB control is in a paint loop. I have a DoEvents in the loop, which, if I remove, prevents the exception from occuring but then I can't process other messages.
My question is: Is there some way to do the equivalent of an ::AfxLockApp() in VB? I think the rug is getting pulled out from underneath my control while it's in this paint loop. I just want to lock things down while it's in this paint loop so it can't go away until it finishes.
Thanks in advance
My question is: Is there some way to do the equivalent of an ::AfxLockApp() in VB? I think the rug is getting pulled out from underneath my control while it's in this paint loop. I just want to lock things down while it's in this paint loop so it can't go away until it finishes.
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also if you want to close while in DoEvents you could do this...
//some loop is going one here....
//you want to close the window so you use this...
break 'breaks the loop
close 'close your window and so on,,,
//rest of code...
Regards,
Viktor Ivanov
//some loop is going one here....
//you want to close the window so you use this...
break 'breaks the loop
close 'close your window and so on,,,
//rest of code...
Regards,
Viktor Ivanov
ASKER
As it turns out, it doesn't appear the exception is due to the DoEvents. I have yet to figure out what is causing it. Thanks for the suggestions AllenC and Viktornet
Hope this helps
Cheers,
Viktor