在启动时在Outlookbar控件中选择一个选项卡 [英] Selecting a Tab in Outlookbar Control at StartUp

查看:127
本文介绍了在启动时在Outlookbar控件中选择一个选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有一个使用CMFCOutlookBar类的应用程序(带有vs2010的C ++).在CMainFrm 类中,我创建了Microsoft示例中所示的Outlookbar控件.

到目前为止,一切正常,它工作正常.但是,启动时的默认选项卡始终是上次会话退出时的当前选项卡.

因此,我在创建函数"(CMainFrame::CreateOutlookBar,与Microsoft示例中的内容相同)的末尾添加了以下行:

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):

pOutlookBarTabCtrl->SetActiveTab( 0);


它用作对GetActiveTab()的调用返回0.但是,尽管对SetActiveTab进行了调用,但默认选项卡始终是上一个会话退出时当前选项卡的选项卡.

知道如何强制选择吗?
感谢您的帮助

Thierry


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

推荐答案

根据文档, SetActiveTab [ ^ ]函数失败在您的代码中.通过进一步调试SetActiveTab函数来找出失败的原因.我的猜测是,窗口(Outlook控件)仍在创建过程中,而m_hWnd句柄尚未有效.

您可以稍后通过单击按钮或计时器调用SetActiveTab函数来断言这一点,如果该方法可以正常工作,则可以考虑进行设计更改.
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.


这篇关于在启动时在Outlookbar控件中选择一个选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆