none
CTabCtrlWithDisable by Paul DiLascia Issue RRS feed

  • Question

  • I have incorporated the example from the author listed above. However, I have ran into an issue that I can't seem to figure out.

    The issue is that when I run in DEBUG mode, then all is well. When I switch to RELEASE mode, then when the program hits the following code it freezes, well actually it is doing something I just don't know what.

    	CTabCtrl* pTabCtrl = GetTabControl();
    	HWND hWndTab = pTabCtrl->GetSafeHwnd();
    	// get HWND of tab control and subclass it
    	//HWND hWndTab = (HWND)SendMessage(PSM_GETTABCONTROL);
    	m_tabCtrl.SubclassDlgItem(::GetDlgCtrlID(hWndTab), this);
    	for (int i=0; i<4; i++)
    	{
    		// Initially set tab's 1 and 2 as disabled
    		if ((i == 0) || (i == 3))
    			m_tabCtrl.m_bTabEnableList[i] = TRUE;
    		else
    			m_tabCtrl.m_bTabEnableList[i] = FALSE;
    	}
    

    I have tried it multiple ways, and even the code exactly as given in the example does this also. I traced it to the GetDlgCtlrID, and this is where it never returns.

    I got to wondering where is it suppose to get an ID to begin with since there is no real tabctrl, and this is simple a class that is used with no controls.


    class CPropSheet : public CPropertySheet
    {
    	DECLARE_DYNAMIC(CPropSheet)
    
    	CPropSheet();
    	CPropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
    	CPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
    	virtual ~CPropSheet();
    	virtual BOOL OnInitDialog();
    
    
    protected:
    	COLORREF m_crBackground;
    	CBrush m_wndbkBrush;	// background brush
    
    
    	CTabCtrlWithDisable m_tabCtrl;
    
    

    This is how it is defined, and the class is the exact same class that the example on the web has.

    Can anyone tell me what I am doing wrong?

    TIA

    Thursday, January 14, 2010 2:46 AM

Answers

  • OK, I found the issue......

    I needed to create a new class and then use that class for my subclassing, then it worked.
    • Marked as answer by dadoftwins Thursday, January 14, 2010 4:34 AM
    Thursday, January 14, 2010 4:34 AM