Click here to Skip to main content
15,914,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: USB question Pin
Alexander M.,23-Aug-05 15:04
Alexander M.,23-Aug-05 15:04 
Generaldouble click on MainFrame Caption Pin
llapanowski23-Aug-05 10:11
llapanowski23-Aug-05 10:11 
GeneralRe: double click on MainFrame Caption Pin
Maximilien23-Aug-05 10:23
Maximilien23-Aug-05 10:23 
GeneralRe: double click on MainFrame Caption Pin
David Crow23-Aug-05 10:27
David Crow23-Aug-05 10:27 
GeneralRe: double click on MainFrame Caption Pin
Ravi Bhavnani23-Aug-05 14:08
professionalRavi Bhavnani23-Aug-05 14:08 
GeneralQ: updating a dialog from within a loop Pin
maladuk23-Aug-05 10:10
maladuk23-Aug-05 10:10 
GeneralRe: Q: updating a dialog from within a loop Pin
David Crow23-Aug-05 10:30
David Crow23-Aug-05 10:30 
GeneralRe: Q: updating a dialog from within a loop Pin
Chris Losinger23-Aug-05 10:45
professionalChris Losinger23-Aug-05 10:45 
multi-threading is the most elegant way to handle this. but, there's always the bad-old Message Pump:

void MsgPump()
{
    DWORD dwLen = 100;

    MSG m_msgCur;
	
    CWinApp *pWinApp = AfxGetApp();                     
	
    DWORD dInitTime = GetTickCount();
	
    while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE)  &&
        (GetTickCount() - dInitTime < dwLen) )
    {
       pWinApp->PumpMessage();
    }
}


call this somewhere in your loop. it's not necessary to call it every iteration, but just a few times each second will be enough to keep the UI alive.

of course, now you need to be able to handle things the user will do things with your buttons, menus, etc., while your loop is running. (i usually just disable all controls and watch out for WM_CLOSE and WM_QUIT).


Cleek | Image Toolkits | Thumbnail maker

GeneralRe: Q: updating a dialog from within a loop Pin
Ravi Bhavnani23-Aug-05 14:09
professionalRavi Bhavnani23-Aug-05 14:09 
GeneralVSS has me concerned.... Pin
charlieg23-Aug-05 9:09
charlieg23-Aug-05 9:09 
GeneralRe: VSS has me concerned.... Pin
Maximilien23-Aug-05 10:32
Maximilien23-Aug-05 10:32 
GeneralRe: VSS has me concerned.... Pin
charlieg23-Aug-05 10:42
charlieg23-Aug-05 10:42 
GeneralRe: VSS has me concerned.... Pin
Taka Muraoka23-Aug-05 16:00
Taka Muraoka23-Aug-05 16:00 
GeneralRe: VSS has me concerned.... Pin
Peter Weyzen23-Aug-05 11:15
Peter Weyzen23-Aug-05 11:15 
GeneralRe: VSS has me concerned.... Pin
Graham Bradshaw23-Aug-05 13:12
Graham Bradshaw23-Aug-05 13:12 
GeneralRe: VSS has me concerned.... Pin
charlieg23-Aug-05 14:13
charlieg23-Aug-05 14:13 
GeneralRe: VSS has me concerned.... Pin
charlieg23-Aug-05 16:34
charlieg23-Aug-05 16:34 
Generaldisplay images Pin
Aditya Rao23-Aug-05 7:41
Aditya Rao23-Aug-05 7:41 
QuestionHow to write Z-Order manager? Pin
dy1323-Aug-05 6:47
dy1323-Aug-05 6:47 
AnswerRe: How to write Z-Order manager? Pin
Alexander M.,23-Aug-05 15:07
Alexander M.,23-Aug-05 15:07 
GeneralSending keys to another program / SendInput() Pin
al_in_the_city23-Aug-05 6:38
al_in_the_city23-Aug-05 6:38 
GeneralRe: Sending keys to another program / SendInput() Pin
David Crow23-Aug-05 6:55
David Crow23-Aug-05 6:55 
GeneralRe: Sending keys to another program / SendInput() Pin
al_in_the_city23-Aug-05 8:59
al_in_the_city23-Aug-05 8:59 
GeneralRe: Sending keys to another program / SendInput() Pin
David Crow23-Aug-05 10:30
David Crow23-Aug-05 10:30 
GeneralRe: Sending keys to another program / SendInput() Pin
Alexander M.,23-Aug-05 15:10
Alexander M.,23-Aug-05 15:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.