Skip to main content
gamedev.net
🔒 Locked

WIN32 CreateDialog problem!

Started by michaelj 1 reply 1.1k views
Original Post
michaelj
michaelj
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.
ApochPiQ
ApochPiQ
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.