Click to See Complete Forum and Search --> : Dialog Create


April 29th, 1999, 04:10 AM
I want to make modeless dialog in following method.

My project is SDI windows.
I make many dialog that has same resource.

My Source is here.

m_pSendMessageDlg = new CSendMessageDlg;

m_pSendMessageDlg->Create(IDDLG_SEND_MESSAGE);
m_pSendMessageDlg->CenterWindow();
m_pSendMessageDlg->ShowWindow(SW_SHOW);
m_pSendMessageDlg->UpdateWindow();

But this code is wrong.
Because this program is dialog resource leak.

please answer this method.

My E-Mail Address woodol@hnc.co.kr

rajasekar.s
April 29th, 1999, 01:31 PM
hi,

Add handler for PostNcDestroy and use delete this inside the handler as shown below

void CSendMessageDlg::PostNcDestroy()
{
CDialog::PostNcDestroy();
delete this;
}

i do this normally and i havent had any side effects, if u face any please post it !