none
CTabCtrlWithDisable by Paul DiLascia Issue (Still exists after all) RRS feed

  • Question

  • I thought I had this resolved, as it worked from my home computer with Vista but when I got to work it has the same issue under XP. Not sure why that code is causing problems on XP but not Vista, but I definately could use some help to resolve this issue.

    When I run it with the debug *.exe it has no issue, and only does this when I run the *.exe. Everything works fine in the VC2005 also.

    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
    
    
    
    
    
    	CMyTabCtrl 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 6:22 PM

All replies