Click here to Skip to main content
15,895,529 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Date validation? Pin
David Crow24-Apr-08 10:34
David Crow24-Apr-08 10:34 
QuestionCWebBrowser2 related help please Pin
gangar17-Apr-08 8:01
gangar17-Apr-08 8:01 
GeneralRe: CWebBrowser2 related help please Pin
bob1697217-Apr-08 14:44
bob1697217-Apr-08 14:44 
GeneralRe: CWebBrowser2 related help please Pin
gangar17-Apr-08 16:58
gangar17-Apr-08 16:58 
GeneralCrash dump in vista Pin
rrrado17-Apr-08 6:52
rrrado17-Apr-08 6:52 
GeneralRe: Crash dump in vista Pin
TalSt17-Apr-08 9:37
TalSt17-Apr-08 9:37 
GeneralRe: Crash dump in vista Pin
Stephen Hewitt17-Apr-08 15:15
Stephen Hewitt17-Apr-08 15:15 
GeneralMoving project to a Unix Platform Pin
Andy20217-Apr-08 6:48
Andy20217-Apr-08 6:48 
GeneralRe: Moving project to a Unix Platform Pin
David Crow17-Apr-08 6:53
David Crow17-Apr-08 6:53 
GeneralRe: Moving project to a Unix Platform Pin
Andy20218-Apr-08 0:44
Andy20218-Apr-08 0:44 
GeneralMAPIFolderPtr olItemType Pin
pnpfriend17-Apr-08 5:30
pnpfriend17-Apr-08 5:30 
GeneralProgrammatic send copy command (CTRL+C) Pin
yytg17-Apr-08 4:10
yytg17-Apr-08 4:10 
GeneralRe: Programmatic send copy command (CTRL+C) Pin
led mike17-Apr-08 4:24
led mike17-Apr-08 4:24 
QuestionRe: Programmatic send copy command (CTRL+C) Pin
David Crow17-Apr-08 4:26
David Crow17-Apr-08 4:26 
GeneralRe: Programmatic send copy command (CTRL+C) Pin
CPallini17-Apr-08 4:38
mveCPallini17-Apr-08 4:38 
AnswerRe: DoEvents in C++ Pin
Nathan Holt at EMOM17-Apr-08 7:37
Nathan Holt at EMOM17-Apr-08 7:37 
yytg wrote:
I tried to imitate the function DoEvents as so



yytg wrote:
But when I call the functions - it's not working...
How do I do it in C++


I've had a need to implement DoEvents in C++ myself, and wrote something that works. Here is what I came up with.

namespace
{
    void DoEventsPumpMessage()
    {
        CWinThread *pThread = AfxGetThread();
        if( !pThread->PumpMessage() )
        {
            int nResult = (int)AfxGetCurrentMessage()->wParam;  // value from PostQuitMessage
            ::PostQuitMessage(nResult);        // so the main message loop will get it.
            TRACE("DoEvents Received quit message\n");
            CQuitMessageException::Throw();
        }
    }
}

void DoEvents( bool bAtLeastOne )
{
    if( bAtLeastOne )
    {
        DoEventsPumpMessage();
    }

    MSG message;
    while( ::PeekMessage( &message, NULL, 0, 0, PM_NOREMOVE ) )
    {
        DoEventsPumpMessage();
    }
}


Many message loops I've seen just assume there won't be a quit message, but in my case, I really wanted to avoid runaway background threads.

Nathan
QuestionChanging Window Main Frame Caption String Visual C++ Pin
Kwanalouie17-Apr-08 4:02
Kwanalouie17-Apr-08 4:02 
GeneralRe: Changing Window Main Frame Caption String Visual C++ Pin
David Crow17-Apr-08 4:24
David Crow17-Apr-08 4:24 
AnswerRe: Changing Window Main Frame Caption String Visual C++ Pin
Kwanalouie17-Apr-08 5:08
Kwanalouie17-Apr-08 5:08 
GeneralRe: Changing Window Main Frame Caption String Visual C++ Pin
David Crow17-Apr-08 5:19
David Crow17-Apr-08 5:19 
AnswerRe: Changing Window Main Frame Caption String Visual C++ Pin
Kwanalouie17-Apr-08 6:30
Kwanalouie17-Apr-08 6:30 
AnswerRe: Changing Window Main Frame Caption String Visual C++ Pin
Kwanalouie17-Apr-08 6:44
Kwanalouie17-Apr-08 6:44 
GeneralRe: Changing Window Main Frame Caption String Visual C++ Pin
David Crow17-Apr-08 6:52
David Crow17-Apr-08 6:52 
AnswerRe: Changing Window Main Frame Caption String Visual C++ Pin
led mike17-Apr-08 4:27
led mike17-Apr-08 4:27 
GeneralEdit in Flexgrid Pin
sunny_vc17-Apr-08 3:13
sunny_vc17-Apr-08 3:13 

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.