DoEvents Equiv in VC++
-
Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick
-
Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick
To refresh the screen, call Invalidate(). To respond to events while in a loop you should really have a UI thread and a worker thread. Otherwise the loop will stop the GUI from responding. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOz
I live in Bob's HungOut now
-
Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick
the mfc-way:
void DoEvents()
{
MSG m;
while(::PeekMessage(&m, 0, 0, 0, PM_NOREMOVE))
AfxGetApp()->PumpMessage();LONG lIdle = 0; while(AfxGetApp()->OnIdle(lIdle++ )) ;
}
have fun... jk :cool: