Re: Modelless Dialog trouble
you must use a pointer
CTestDlg *testdlg;
testdlg=new(CTestDlg);
testdlg->Create(IDD_TESTDLG, NULL);
testdlg->ShowWindow(SW_SHOW);
because when you exit from the function that call Create() and ShowWindow() the object testdlg is destroied.
If you don't want use a pointer you must declare CTestDlg testdlg; as public variable
Re: Modelless Dialog trouble
hi,
u cannot create Dialog like that. U should be use pointer.
CTestDlg *testdlg; //put it into class
{
testdlg=new CTestDlg;
testdlg->Create(IDD_TESTDLG, NULL);
testdlg->ShowWindow(SW_SHOW);
}
Regards,
soundar
Re: Modelless Dialog trouble
Ahha. That makes sense. I should have known. Thanks alot.
Re: Modelless Dialog trouble
Thank you. That was very helpful.
Re: Modelless Dialog trouble
Hi;
There's nothing wrong with doing that, but *I think* you'll have a memory leak since you are using the 'new' command. It probably won't cause any major problems, but, nonetheless. You should probably declare a variable m_MyModlessDlg as part of the calling class, that way you can properly destroy the Modeless Dialog.
Scott.
Re: Modelless Dialog trouble
Now that you mention it, you are probably right about the memory leak thing. I will go about it your way. Thanks for the help. I appreciate it.
Re: Modelless Dialog trouble
Or (and some disagree), you could override OnNcDestroy() and call:
delete this;
Just a thought so the dialog will manage it's own deletion.
Chris