Jump to content
  • Advertisement
Sign in to follow this  
michaelj

WIN32 CreateDialog problem!

This topic is 4485 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 want to show a dialog bar in a win32 window, so I do this: ************** case ID_TEST_CREATE_DIALOG: { HWND hdlg = CreateDialog(hInst, "DIALOG_A", hMainWnd, (DLGPROC)DialogProcDiaglog1); ShowWindow(hdlg, SW_SHOW); } break; ************** But it doesn't work, the dialog isn't created. when using MAKEINTRESOURCE(IDD_DIALOG_A), it works well and the dialog is created. I wonder how to specify the dialog box template's name?? The following is MSDN's content on this API: HWND CreateDialog(HINSTANCE hInstance, LPCTSTR lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc ); and it explains the "LPCTSTR lpTemplate" parameter: This parameter is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
If you want to specify the name of the dialog as a string, you need to name the dialog resource with a string. Otherwise use a symbolic constant and use the MAKEINTRESOURCE macro. You can't interchange the two.

Share this post


Link to post
Share on other sites
To elaborate a bit, IDD_DIALOG_A is just a macro that is replaced with a numeric ID when your EXE is compiled. You can see this by viewing the resource.h file by hand, or by opening the final EXE file in a resource editor.

As the AP said, you will need to either manually name the resource with a string, or use MAKEINTRESOURCE.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!