Thanks; this is what I have, but when I run it nothing happens.
Code:
LRESULT CALLBACK MainMenu(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CREATE:
MessageBox(NULL, "hi", "", MB_OK);
break;
case WM_INITDIALOG:
return true;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return true;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefDlgProc(hDlg, uMsg, wParam, lParam);
}
return false;
}
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX window;
MSG msg;
HWND hWnd;
LPCTSTR className = "IDD_MAINMENU", windowName = "test";
window.cbSize = sizeof(WNDCLASSEX);
GetClassInfoEx(hInst, "IDD_MAINMENU", &window);
window.lpfnWndProc = MainMenu;
RegisterClassEx(&window);
hWnd = CreateWindow(className, windowName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, 500, 500, NULL, NULL, hInst, NULL);
ShowWindow(hWnd, nShowCmd);
UpdateWindow(hWnd);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}