Sign in to follow this  

Dialog box troubles...

This topic is 4357 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

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

Share this post


Link to post
Share on other sites
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:

DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), g_hWnd, AdministratorDialogProc)

See MSDN as well.

Illco

Share this post


Link to post
Share on other sites

This topic is 4357 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this