The information in this article applies to:
SYMPTOMSAttempting to set the text for a tooltip in the OnToolHitTest function of a CWnd by assigning a resource ID to the TOOLINFO struct's lpszText member causes the following assertion to occur: For example, setting the TOOLINFO struct as follows:
where pTI is a pointer to the TOOLINFO struct, will cause the problem.
Setting the TOOLINFO struct members in this manner allows the programmer to
specify a resource that the tooltip uses to get the text for the tooltip.
CAUSEThe CWnd::FilterToolTipMessage() function contains the following code:
Because lpszText is not set to LPSTR_TEXTCALLBACK, the free function is
called. However, a resource ID, rather than a string, was specified in the
OnToolHitTest() function, and therefore the assertion occurs.
RESOLUTIONInstead of specifying a resource ID to load, load the resource and assign the text to the TOOLINFO struct's lpszText member as follows:
MFC frees the allocated buffer after it has added the tool (that is, after
it has sent the TTM_ADDTOOL message).
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual C++ version 5.0. Additional query words: kbVC400bug tool tip
Keywords : kbMFC KbUIDesign kbVC kbVC500fix |
Last Reviewed: July 28, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |