CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Dialog Create

  1. #1
    Guest

    Dialog Create

    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 [email protected]


  2. #2
    Join Date
    Apr 1999
    Location
    Chennai, India
    Posts
    48

    Re: Dialog Create

    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 !



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured