Mojtaba Fathi | 25 Jun 13:42
Picon
Favicon

This seems to be a bug in WTL::CCommandBarCtrlImpl class template


Hi

The WTL::CCommandBarCtrlImpl class template has a member variable named m_wndParent, which it uses to
capture messages from it's parent window. This member must be released in response to WM_DESTROY
message, to prevent incorrectly capturing the messages from parent, but it is released in the
destructor. I think the following piece of code which exists in destructor, must be duplicated somewhere
within the body of WTL::CCommandBarCtrlImpl::OnDestroy:

// CODE STARTS HERE
        if(m_wndParent.IsWindow())
            m_wndParent.UnsubclassWindow();
// CODE ENDS HERE

If I'm true, WTL::CCommandBarCtrlImpl::OnDestroy function could be like this:

// CODE STARTS HERE
    LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
    {
        LRESULT lRet = DefWindowProc(uMsg, wParam, lParam);

        // START OF NEWLY ADDED CODE
        if(m_wndParent.IsWindow())
            m_wndParent.UnsubclassWindow();
        // END OF NEWLY ADDED CODE
            
            ...
            
// CODE ENDS HERE

Regards, Moji            

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
    mailto:wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Gmane