Jump to content
  • Advertisement
Sign in to follow this  

Dialog Hell

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

Okay someone may know something that I cannot find. I am trying to add a dialog to a window that I have created. This dialog will have editing features such as frames for animation etc. Also the dialogs in the other child windows will also serve as my main editors for the game. the simple question is how do you attach a dialog to the child window? I am coding in win32, c++ with no MFC. Thank ya thank ya avareh mushhhh Aviscowboy

Share this post

Link to post
Share on other sites
It seems after looking through GameDev.Net I am seeing a lot of posts on this subject but no solutions... can someone make a tutorial on this matter?

Share this post

Link to post
Share on other sites
The question doesn't make sense. What have you tried? What errors are you getting?

To create a modal dialog box call DialogBox or one of it's kin. For a modeless dialog use CreateDialog.

Petzold or pretty much any other book on basic Win32 programming will devote a couple of chapters to this sort of stuff.

Share this post

Link to post
Share on other sites
Give it the WM_CHILD attribute, which should be accessable in the dialog editor. Then when creating it give it a parent window, it'll be embedded as such. Remember coordinates follow the parent.

Hope this helps. You may wanna look into Win32 a bit more. If you're going to be doing a control the best way would probably be active x. just because that's the norm. Me I don't do it because I'm lazy, but hell the proper way to create new controls and such is with active x. That way you can take it to and from different languages.

Share this post

Link to post
Share on other sites
You mean like using property pages, like this:

If so, then you want to just use the WM_CHILD style when you create the dialog resource, and CreateDialog[Param](), passing the parent window as the hWndParent parameter. Here's some source snippets from my code:

bool CSettingsPage::Create(CSettingsDlg* pParent)
// Do pre-init //
m_pParent = pParent;

// Create window //
m_hWnd = CreateDialogParam(m_hInstanceTemplate,m_szTemplateID,
return false;

// Enable tab control //
LONG lOldStyle = GetWindowLong(m_hWnd,GWL_EXSTYLE);
SetWindowLong(m_hWnd,GWL_EXSTYLE,lOldStyle | WS_EX_CONTROLPARENT);

// Load icon //
m_hIcon = LoadIcon(m_hInstanceIcon,m_szIconID);
return true;

The "Enable tab control" bit is so you can use the tab key to properly change controls on the child sheet.
And then to call CSettingsPage::Create():

void CSettingsDlg::OnInitDialog()
RECT rc;
LVITEM theItem;
STitleInfo theInfo;

// Get position of pages //
pt.x = rc.left; pt.y = rc.top;
rc.left -= pt.x; rc.right -= pt.x;
rc.top -= pt.y; rc.bottom -= pt.y;
m_bCreating = true;

// Create & move pages //
for(i=0; i<m_vPages.size(); ++i)


// Snip

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!