Sign in to follow this  

Dialog Hell

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
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.left -= pt.x; rc.right -= pt.x; -= 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

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