Thread: Message loop not working...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    Exclamation Message loop not working...

    Ok, here I have some code (very stripped down so it isn't too boring to read):
    Code:
    HWND dlg = CreateDialog(hinst, MAKEINTRESOURCE(IDD_TRANSFER),
                   parent, UploadProc);
    ShowWindow(dlg, SW_SHOW);
    
    MSG msg;
    bool done = false;
    while(!done && !file.eof()) //I don't think file is the problem
    {
        while(PeekMessage(&msg, dlg, 0, 0, PM_REMOVE))
        {
            if(msg.message == WM_CLOSE ||
                (msg.message == WM_COMMAND && LOWORD(msg.wParam) == IDCANCEL))
            {
                done = true;
                server->send(ICV_OP_CANCEL);
                break;
            }
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        if(done)
            break;
        //Other stuff
    }
    
    DestroyWindow(dlg);
    IDCANCEL is a button that says "cancel". For some reason, this message loop doesn't seem to want to quit, and I can't figure out for the life of me why, since clicking the x in the corner of the dialogbox should (in my world) send WM_CLOSE. Can anybody help me out here? It's sorta a big thing for me, since I thought I had Windows messages all sorted out already
    Last edited by Hunter2; 06-26-2003 at 06:15 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to understand the message loop
    By bling in forum Windows Programming
    Replies: 4
    Last Post: 08-08-2008, 09:27 AM
  2. Message loop
    By beene in forum Game Programming
    Replies: 2
    Last Post: 11-26-2007, 05:19 PM
  3. "try again" loop not working
    By scwizzo in forum Game Programming
    Replies: 5
    Last Post: 04-01-2007, 09:56 PM
  4. Pausing in the message loop
    By IdioticCreation in forum Game Programming
    Replies: 7
    Last Post: 01-22-2007, 07:21 PM
  5. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM