I'm using MSVC++6 Professional to make this project. I'm using the Resource Editor to build the Dialog box (IDD_DIALOG1) with controls and what not.
Everything works just fine except for the fact that when I run my program, and then close it... clicking the X on the system menu doesn't work. Minimize does. Maximize does. I must be missing something. Do I need a different Message loop? I can't find any documentation on specific DialogBox msg loops.
Am I doing it all wrong?
Heres the code:
Code:
#include<windows.h>
#include "resource.h"
LRESULT CALLBACK DialogProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, int ShowCmd)
{
MSG msg;
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc);
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
{
return TRUE;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
}
return 0;
}
Thanks for the help,
spoon_