Dialog box troubles...
Hello, I am trying to add a simple dialogbox to my application. I am using VC++6.
After inserting the new resource (insert->resource) I then save the script and include resource.h.
However when I call the DialogBox method like so:
DialogBox(hInstance, TEXT("IDD_DIALOG1"), g_hWnd, AdministratorDialogProc)
(Where IDD_DIALOG1 is the ID of the dialog box)
the method fails. GetLastError returns 1812, or 1814.
ERROR_RESOURCE_DATA_NOT_FOUND
1812 The specified image file did not contain a resource section.
ERROR_RESOURCE_NAME_NOT_FOUND
1814 The specified resource name cannot be found in the image file.
I have tried this over and over again and I can't get it to work. Can anyone see what I might be doing wrong?
Thanks in advance,
Mark
Yes. You misinterpreted the parameters for DialogBox. The resource (IDD_DIALOG) is a constant for an integer value, not a string. You should use the MAKEINTRESOURCE macro to obtain the right parameter for DialogBox:
See MSDN as well.
Illco
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), g_hWnd, AdministratorDialogProc)
See MSDN as well.
Illco
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement