| | |
Modal dialogs HELP!!!
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 5
Reputation:
Solved Threads: 0
Hi everyone,
I have a modal dialog box which is called by the main thread. This dialog has no parent (appears at center screen, overlapped, and shown in taskbar). When the user clicks "Save" in the dialog, the dialog procedure receives the command and displays a save file dialog (GetSaveFileName).
The problem is that the second dialog (Save Dialog) doesn't work at all. It can't be activated, and seems kind of frozen (can't be closed, buttons and scroll bars are frozen). Here's my code:
Whatever dialog type I put at this line (print dialog, modal dialog, modeless dialog), it doesn't behave properly. What am I missing?
I tried with OFN.hwndOwner = NULL, but doesn't work.
Thanks in advance!
I have a modal dialog box which is called by the main thread. This dialog has no parent (appears at center screen, overlapped, and shown in taskbar). When the user clicks "Save" in the dialog, the dialog procedure receives the command and displays a save file dialog (GetSaveFileName).
The problem is that the second dialog (Save Dialog) doesn't work at all. It can't be activated, and seems kind of frozen (can't be closed, buttons and scroll bars are frozen). Here's my code:
c++ Syntax (Toggle Plain Text)
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(101), NULL, DialogProc); MSG msg; while (GetMessage(&msg, NULL, 0, 0) != 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; } INT_PTR CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; switch (message) { case WM_COMMAND: switch(LOWORD(wParam)) { case IDSAVE: OPENFILENAME OFN; OFN.hwndOwner = hWnd; [...] //PROBLEM IS HERE. The save file dialog is half-frozen and never returns. if (GetSaveFileName(&OFN)) {[...]} break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return true; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); EndPaint(hWnd, &ps); break; case WM_INITDIALOG: [...] return true; case WM_CLOSE: [...] return true; case WM_DESTROY: [...] return true; default: return DefWindowProc(hWnd, message, wParam, lParam); } return false; }
I tried with OFN.hwndOwner = NULL, but doesn't work.
Thanks in advance!
•
•
Join Date: Mar 2008
Posts: 1,486
Reputation:
Solved Threads: 123
Is there too much code to post the whole thing, so i can try and compile exactly what you've got? I'm sure I could solve it if i could compile it.
Last edited by William Hemsworth; Sep 7th, 2009 at 2:27 pm.
I need pageviews! most fun profile ever :)
![]() |
Other Threads in the C++ Forum
- Previous Thread: infinte loop
- Next Thread: my first "real" program :twisted:
| Thread Tools | Search this Thread |
Tag cloud for api, c++, dialog, modal, savefile, win32
aim aol api apic++ apple application array arrays assignment binary bitmap blogger blogging borland c# c++ char char* class code compile compression console developer development dialog download dwmapi email encryption error facebook failed file fstream function functions game gdata google graph guessing html ide int iphone java linux map math method microsoft music myspace mysql networking newbie news opensource output pause php problem program programing programming project python read recursion recursive rpg rss rules search server socialnetwork space stream string strings struct subclass system template templates text tree tutorial twitter url visual visualization vmware voice voip web win32 windows xml







