Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window creating

Status
Not open for further replies.

DeCoDeR

Programmer
Joined
Jun 4, 2002
Messages
37
Location
US
Hi ,
I try to write a program using win32 apis.
i create a new project from vc 6.0 ide.
i insert predesigned dialog as resource and i want to use this dialog as my main window.
how can i achivee this ?
i mean, we use CreateWindow api but how can i combine my dialog with createwindoýw ?


Read between the lines
 
If you are NOT using MFC, use DialogBox or DialogBoxParam to create a modal dialog. Use CreateDialog or CreateDialogParam to create a modeless dialog.

If you ARE using MFC, simply use ClassWizard (while in the Dialog Editor, press Ctrl+W) to add a new class for your dialog. Then, in the calling code, use this code--modify it with the name of your dialog class.

[tt]CExampleDlg dlg;
dlg.DoModal();[/tt]

That would create a modal dialog. For a modeless dialog this would work:

[tt]CExampleDlg *pDlg = new CExampleDlg;
pDlg->Create(CExampleDlg::IDD,[/tt]pointer to owner CWnd[tt]);[/tt]

Notice in the second example, the object is dynamically allocated. This is necessary for a modeless dialog because if it is created on the stack, it will be destroyed at the end of the calling function.

I REALLY hope that helps.
Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top