Hi there,
I just about managed to get a very simple dialog box running in a small windows program. I'm actually quite pleased I made it even this far.
It looks quite nice But... it causes the whole program to hang up and whenever I click anywhere on the entire window (including the box itself) I get that nice little noise Windows makes when something is wrong. I cannot even minimize or exit the window so I have to run in debug mode and close it from there.
My suspicions are that I have called the dialog box in an incorrect way or at the wrong time and have screwed up the Windows message loop.
Here's a portion of the code:
Code:
ShowWindow(hwnd, nCmdShow);
// Run the message loop.
DialogBoxW(hInstance, (LPCWSTR)IDD_PROPPAGE_SMALL, hwnd, DlgProc);
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
I've added bold to the dialog box function call. The DlgProc message handling function is as basic as I could get:
Code:
LRESULT CALLBACK DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
// Button1 Pressed
case IDC_BUTTON1:
{
EndDialog(hwnd, 0);
return 0;
} break;
}
}
} // switch [uMsg]
return 0;
}
I checked the identifier for the only button on there and it is indeed IDC_BUTTON1. If anyone can help please do thanks, or recommend an up to date book I can get for Win32 programs so I can get my learning sorted out. I wouldn't even know where to start
I hope that made some sense, thanks