Override OnClose()

Posted by CruelIO on Stack Overflow See other posts from Stack Overflow or by CruelIO
Published on 2010-06-17T11:47:27Z Indexed on 2010/06/17 11:53 UTC
Read the original article Hit count: 196

Filed under:
|
|

I got this class

class CWebBrowser2 : public CWnd

And i want to override OnClose What i have done so far is in the header file I added void OnClose(); and in the .cpp file i added

void CWebBrowser2::OnClose ()
{
        int i=0;
        i++;
}

But the OnClose is never called.

Then I tried to to modify the header file to

afx_msg void OnClose();
DECLARE_MESSAGE_MAP()

And added this to the .cpp file

BEGIN_MESSAGE_MAP(CWebBrowser2, CWnd)
    //{{AFX_MSG_MAP(CBrowserDlg)
    ON_WM_CLOSE()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

But still OnClose is never called. I have tried to Change to OnClose to OnDestroy but that isnt called either.

any ideas on what Im doing wrong?

© Stack Overflow or respective owner

Related posts about c++

Related posts about events