Jump to content
  • Advertisement
Sign in to follow this  
mrmrcoleman

Dialog box troubles...

This topic is 4520 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
Advertisement
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
Illco,

Thank you so much. That has been bugging me for hours. I don't know how I missed that, probably because I was learning from a few different sources.

Thanks again,

Mark

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!