Original Post
ive used the win32 macro create dialog a hundred times before. i copied and pasted some existing code into a new project and tweaked it a little bit (mostly stuff outside WinMain or way after CreateDialog is called). now for some reason the program runs then doesnt do anything, its like it crashes but it doesnt give me an error message. it almost as if somewhere something is calling PostQuitMessage before the program can even show itself here is my WinMain function. I added in some MessageBox calls to narrow it down. this is how i am positive it is CreateDialog and not something else.
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPreviousInstance, LPSTR lpCmdLine, int iShowCmd)
{
g_hInstance=hInstance;
MessageBox(0,"1","Error",MB_OK);
HWND hWnd=0;
hWnd=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOG_MAIN),0,(DLGPROC)DialogProc);
MessageBox(0,"2","Error",MB_OK);
if (!hWnd)
{
MessageBox(0,"Could not create window.","Error",MB_OK);
return 0;
}
g_hWnd=hWnd;
ShowWindow(hWnd,SW_SHOWNORMAL);
UpdateWindow(hWnd);
MSG Msg;
while (GetMessage(&Msg,0,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}
as you can see there isnt much to it at all. IDD_DIALOG_MAIN and DialogProc are valid (it wouldnt compile if they werent). i am at a total loss because i just used this code the other day and it worked, ive included all the right files, made sure the right kind of project was used and made sure i havent made any other newbie mistakes... as far as DialogProc goes it just handles the quit and destroy messages, but that cant be the cause. the program shows the first message box but not the second.... it exits before it even gets to it...
Bungo!