Sign in to follow this  

Trying to load a .rc Dialog

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

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