Probleme mit Darstellung einer DialogBox
-
Hallo!
Mein Problem ist, dass meine DialogBox nicht angezeigt wird. Ich habe bereits die Hinweise aus dem FAQ durch, doch meine DialogBox wird trotzdem nicht angezeigt.
#include <windows.h> #include "resource.h" LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK DialogProc (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static char szAppName[] = "Find"; HWND hwnd; MSG msg; WNDCLASSEX wndclass; wndclass.cbSize = sizeof (wndclass); wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = DLGWINDOWEXTRA; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon (hInstance, szAppName); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName; wndclass.hIconSm = LoadIcon (hInstance, szAppName); RegisterClassEx (&wndclass); hwnd = CreateDialog (hInstance, szAppName, 0, DialogProc); ShowWindow (hwnd, iCmdShow); while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } return msg.wParam; } LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { case WM_COMMAND : switch (LOWORD (wParam)) { case BNOK : break; case ED_WILDCARD : break; } break; case WM_DESTROY : PostQuitMessage (0); return 0; } return DefWindowProc (hwnd, iMsg, wParam, lParam); } BOOL CALLBACK DialogProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { case WM_INITDIALOG : return TRUE; case WM_CLOSE : EndDialog (hDlg, 0); return TRUE; } return FALSE; }Und hier mein Resourcenskript:
Find DIALOG DISCARDABLE 0, 0, 272, 330 STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU CAPTION "Find" CLASS "Find" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "Verzeichnis auswählen",BNOK,5,5,90,14 EDITTEXT ED_WILDCARD,5,30,90,15,ES_AUTOHSCROLL EDITTEXT ED_AUSGABE,6,61,254,259,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY ENDVielen Dank für eure Hilfe.
-
Fehlermeldung? Rückgabe von CreateDialog? Ein wenig mehr Info wäre hilfreich...
-
Es kommt keine Fehlermeldung. Der Dialog wird nicht angezeigt ist aber als Prozess im Task-Manager vorhanden.
-
ersetz mal diese Zeile hier:
ShowWindow (hwnd, iCmdShow);
durch die hier:
ShowWindow (hwnd, SW_SHOW);
-
Es passiert das, was vorher auch schon passiert ist. Kein Dialog zu sehen, aber der Prozess läuft.
-
Was sagt denn GetLastError() nach dem Aufruf von CreateDialog?
-
So funzt es bei mir:
CreateDialog(instanceHandle, MAKEINTRESOURCE(IDD_DIALOG1), 0, DialogProc);
MfG