Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello

I have an application (C++ with vs2010) that use the CMFCOutlookBar class. In the CMainFrm class, I create the Outlookbar Control as shown on Microsoft sample...

So far so good, it works fine. However, the default tab at startup is always the tab that was the current tab on exit of the last session.

So I add the following line at the end of the Create Function (CMainFrame::CreateOutlookBar, the same as in the Microsoft sample):
C++
pOutlookBarTabCtrl->SetActiveTab( 0);

It works as the call to GetActiveTab() returns 0. However, despite the call to SetActiveTab, the default tab is always the one that was the current tab on exit of the last session.

Any idea how to force this selection ?
Thanks for your help

Thierry
Posted
Updated 3-Oct-11 16:42pm
v2

1 solution

As per the documentation, SetActiveTab[^] function failed in your code. Find out why it is failed by debugging further to SetActiveTab function. My guess is, the window (The outlook control) yet in creation process and the m_hWnd handle is not yet a valid one.

You can assert this by calling the SetActiveTab function later from a button click or timer, if it is working then, you may consider a design change.
 
Share this answer
 
Comments
UrbanBlues 4-Oct-11 14:38pm    
Hello

Well, I got no problem calling the functions and got no assert. the m_hWnd is a valid handle. But you drive me in the right direction. I add these lines in InitInstance function, just before the call to m_pMainWnd->ShowWindow(SW_SHOW);

// Get OutlookBar

COutlookBar* pOutlookBar = (( CMainFrame*) m_pMainWnd)->GetNavigationBar();

if ( pOutlookBar != ( COutlookBar*) NULL)
pOutlookBar->GetUnderlyingWindow()->SetActiveTab( 0);
*/
And it works perfectly....

Thanks for your help

Thierry

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900