Jump to content
  • Advertisement
Sign in to follow this  
Roziks_World

Trying to load a .rc Dialog

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

Hi everyone, i am trying to load a Dialog from a .rc file i created and its just not loading:-( i created the dialog in Visual Studio 2008 and its Called dlgChangeDialog and has the same ID now i try to call the DialogBox function like this: nResult = DialogBox(m_hDLL, LPCWSTR("dlgChangeDevice"), hWnd, DlgProcWrap); but nResult is always -1 can anyone tell me what i might be doing wrong? Thx a lot in advance for any hints you guys might have

Share this post


Link to post
Share on other sites
Advertisement
Are you using Unicode?

Anyhow, you should NEVER cast a string like that. If there is a warning it's there for a reason.

If you're using Unicode change the line to:

DialogBox( m_hDLL, L"dlgChangeDevice", hWnd, DlgProcWrap );

else to:

DialogBox( m_hDLL, "dlgChangeDevice", hWnd, DlgProcWrap );


If neither works try the MAKEINTRESOURCE makro:

DialogBox( m_hDLL, MAKEINTRESOURCE( dlgChangeDevice ), hWnd, DlgProcWrap );

dlgChangeDevice should be defined in resource.h, don't forget to include it.

Share this post


Link to post
Share on other sites
I had same kind of a problem just yesterday. After trying nearly everything I found out that dialogs created with DialogBox() don't support all window controls. In my case the conflicting control was a status bar. After I removed it the dialog loaded fine.

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!