1

Topic: Closing of bookmarks in CTabbedChildWindow

And I when that simply added in the initial class CTabbedChildWindow here such code:





//------- handling of closing of the tabulated windows and function SetLastViewNoClose and GetLastViewNoClose for lock is added by me 
//------- closings of windows necessary for application 
private: 
    INT m_lastViewNoClose;//last number of tab which cannot be closed,-1 all closed 

public: 

    void SetLastViewNoClose (INT num) {m_lastViewNoClose = num;} 
    INT GetLastViewNoClose () {return m_lastViewNoClose;} 

    BEGIN_MSG_MAP (thisClass) 
        NOTIFY_CODE_HANDLER (CTCN_CLOSE, OnTabClose)//it is added for handling of the button of closing of a window 
        CHAIN_MSG_MAP (baseClass) 
    END_MSG_MAP () 

    LRESULT OnTabClose (int/*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) 
    { 
        LPNMCTCITEM pnmCustomTab = (LPNMCTCITEM) pnmh; 
        if (pnmCustomTab) 
        { 
            if (pnmCustomTab-> iItem> = 0 && pnmCustomTab-> iItem> m_lastViewNoClose) 
            { 
                TTabCtrl:: TItem* pItem = m_TabCtrl. GetItem (pnmCustomTab-> iItem); 
                if (pItem) 
                { 
                    HWND hWndChild = pItem-> GetTabView (); 
                    if (0 ==:: SendMessage (hWndChild, WM_CLOSE, 0, 0L)) 
                    { 
                        this-> RemoveTab (hWndChild); 
                    }
                }
            }
        }
        bHandled = FALSE; 
        return 0; 
    }




As a result it is possible to block closing of the several first windows and  CTCN_CLOSE, and it is not necessary to write each time.