Jump to content
  • Advertisement
Sign in to follow this  
Carn

Problems with/using CreateDialogue(...)

This topic is 5410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a simple gui I'm working on so I can simplify testing the game engine I'm working and I have some problems. I have the following code: int WINAPI WinMain (...) { h_MainWindow = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_GUI_DIALOG), NULL, (DLGPROC)MainDlgProc); ShowWindow(h_MainWindow, SW_SHOWDEFAULT); while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK MainDlgProc(...) { ... return DefWindowProc(hWnd, msg, wParam, lParam); } IDD_GUI_DIALOG is in a resource script with two edit boxes and two buttons just with the default settings. Whenever I run the program the dialogue displays just fine however it locks up and I can't move it around or close it but I can still type in the edit boxes and any action I have linked to the buttons locks as well the instant it executes even if it is just a simple call to MessageBox(). As far as I can tell my code is correct it should work but it has been driving me nuts for the last two days and I can't seem to figure it out any help with this would be greatly appreciated. Thanks Kevin

Share this post


Link to post
Share on other sites
Advertisement
Check if the 'Disabled' checkbox is checked in the dialog properties, if it is, uncheck it. If you are using visual C++ 6, it is on the More styles tab, I don't know where it is in .Net.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Show more of your dialog box's procedure function.

Share this post


Link to post
Share on other sites
replace ... in MainDlgProc with:

switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}

and checking to make sure the disabled property was not checked that was the first thing I did.

Kevin

Share this post


Link to post
Share on other sites
Check this documentation on DialogProc
Quote:
Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.
Quote:
Although the dialog box procedure is similar to a window procedure, it must not call the DefWindowProc function to process unwanted messages. Unwanted messages are processed internally by the dialog box window procedure.

Share this post


Link to post
Share on other sites
Quote:
Original post by Carn
That solved my problem quite nicely thank you.
no problem.
Quote:
I feel like an idiot now :)
Been there many times, including right now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!