Ok, here I have some code (very stripped down so it isn't too boring to read):
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 alreadyCode: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);![]()



LinkBack URL
About LinkBacks




that's what this is for).
What about DialogBox()? On MSDN it says that DialogBox() calls CreateWindowEx() and then starts up an internal message loop. Why should dialog boxes created with CreateDialog() be any different?
To change a dialogbox, all I do is change dlgState and call EndDialog().