PRB: CToolBarCtrl::GetToolTips() May Return NULL for a ToolBarLast reviewed: July 10, 1997Article ID: Q151894 |
4.00 4.10
WINDOWS NT
kbprg kbprb
The information in this article applies to:
SYMPTOMSAccessing the CToolTipCtrl for a CToolBar with CBRS_TOOLTIPS style, using GetToolBarCtrl() and subsequently using that pointer to call GetToolTips(), returns a NULL value.
CAUSEGetToolTips() returns the pointer to a CToolTipCtrl associated specifically with the CToolBar. The CToolTipCtrl created for a CToolBar by setting the CBRS_TOOLTIPS style is not specific to the CToolBar, but rather, is MFC's CToolTipCtrl common to the entire application.
RESOLUTIONThe common CToolTipCtrl is kept as a part of the MFC thread state information. To access the MFC's common CToolTipCtrl, access m_pToolTip public member of the current thread state:
_AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); CToolTipCtrl* pToolTip = pThreadState->m_pToolTip; STATUSThis behavior is by design.
MORE INFORMATIONIn order to provide ToolTip support for a CToolBar, the CBRS_TOOLTIPS style has to be set during creation or by using CControlBar::SetBarStyle(). This style results in the ToolBar using MFC's thread specific common CToolTipCtrl rather than a unique one for the ToolBar. Since the ToolTip is not specific to the ToolBar, GetToolTips() returns NULL. Note that a CToolTipCtrl specific to a CToolBar can be created by overriding the CToolBar::PreCreateWindow() and setting the TBSTYLE_TOOLTIPS. In this case, the return value of GetToolTips() will be valid.
REFERENCESFor additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q151162 TITLE : PRB: CToolBarCtrl Styles Fail with CToolBar |
Additional reference words: 4.00 4.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |