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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modeless CDialog

Status
Not open for further replies.

qzou666

Programmer
Feb 12, 2002
11
NZ
Hi, there,

I am having a problem with creating a modeless CDialog.

The CDialog code is:

class ADialog : public CDialog
{
// Construction
public:
ADialog(SomeData* data, CWnd* pParent = NULL): CDialog(IDD_ADIALOG, pParent){
Data=data;
}

BOOL Create(CWnd* pParent=NULL){
return CDialog::Create(IDD_ADIALOG, pParent);
}

protected:
virtual void DoDataExchange(CDataExchange* pDX); virtual void OnOk();
virtual void OnCancel();
virtual void PostNcDestroy();

private:

SomeData* Data;
}

The creation code is:

ADialog* pADlg=new ADialog(data, this);

pADlg->Create(this);

With above code, I cannot make the Dialog show. If I use pADlg->DoModal(), the Dialog shows.

Could someone point out what's wrong with my code.

Thanks a lot.
 


I think you need to use MoveWindow call to ensure your window has some size. Perhaps you also need to call ShowWindow(SW_SHOW)... not sure about the SW_SHOW... look it up.

so...

pADlg->Create(this);
pADlg->MoveWindow(....);
pADlg->ShowWindow(...); // maybe u wont need this

hope this helps
 
Thank you.

I found the problem. It turns out that I have to set the Dialog style as "visible" while setting dialog properties for the modeless dialog.

Thanks anyway.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top