CWND from dialog box
-
I created a dialog box using the resource editor. I am wondering how to get the CWND from this so I can create controls during run time. Thanks The wisest of the wise may err. - Aeschylus
Do you use MFC? If YES, the
CDialog
class what the Visual C++ Wizard created is derived fromCWnd
. So, you can use the a member of typeCDialog
on every place where you can useCWnd
. Sample:CMyDialog dlg; dlg.DoModal(); ... **dlg.SetWindowText(_T("Hi!"));** ... **CWnd* pWnd = &dlg;** ... **pWnd->SetWindowText(_T("Hi!"));**
Daniel ;) --------------------------- Never change a running system! -
Do you use MFC? If YES, the
CDialog
class what the Visual C++ Wizard created is derived fromCWnd
. So, you can use the a member of typeCDialog
on every place where you can useCWnd
. Sample:CMyDialog dlg; dlg.DoModal(); ... **dlg.SetWindowText(_T("Hi!"));** ... **CWnd* pWnd = &dlg;** ... **pWnd->SetWindowText(_T("Hi!"));**
Daniel ;) --------------------------- Never change a running system! -
I created a dialog box using the resource editor. I am wondering how to get the CWND from this so I can create controls during run time. Thanks The wisest of the wise may err. - Aeschylus
If you're running under WIn API, you'll have somewhere in your code a place where you create your main window. This is your CWnd. To add controls in your CDialog, just pass a *CDialog instead of a *CWnd, since CDialog is derived from CWnd (and this, not only in MFC). Finally, if your main win is your dialog, you may pass NULL pointers to create the controls (see MSDN) Hope this helps- ~RaGE();
-
Nope, not using MFC, using the resource editor and the winapi. The wisest of the wise may err. - Aeschylus
Oh... than take a look on what Rage wrote ... Daniel ;) --------------------------- Never change a running system!
-
Nope, not using MFC, using the resource editor and the winapi. The wisest of the wise may err. - Aeschylus
You get the HWND of the dialog (not "CWND") as the first parameter to the dialog box function. Also, if the dialog is modeless, its HWND is the return value from
CreateDialog()
. --Mike-- I'm bored... Episode I bored. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm