you have called CDialog::OnOK in CToolTipTestDlg::OnOK. Thats not the same
code, we have used. We use the OK-Button at the first click on it to show the
tooltip. The dialog should not be closed. After the tooltip is displayed.
to the OK button. That means OnOK is not called by framework.
On Mon, 25 Jun 2007 03:39:00 -0700, ASCO DATA GmbH
<ASCODATAGmbH@discussions.microsoft.com> wrote:
Hi. I tested with InitCommonControls and i am unable to click through the
tooltip. I don't know what is wrong... It works at you by clicking on the
tooltip, the OK button recieves the command to close?
Yes, it does.
This is the manifest file I embedded in resources:
---- Start of Manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="x86"
version="5.1.0.0"
type="win32"
name="test.exe"/>
<description>Test Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="x86"/>
</dependentAssembly>
</dependency>
</assembly>
---- End of Manifest
The platform is Windows XP SP2 with VC++6 SP6.
This is the code (I encapsulated the tool-tip test in TestToolTip
method, and call it from OnOK handler):
<CODE>
void CToolTipTestDlg::ToolTipTest()
{
TOOLINFO TI;
static long nIndex = 0;
CRect rectTemp;
CFont* pfont;
CWnd* pwndOK;
CString text;
text.Format( _T("nIndex = %d"), nIndex );
PREPARE_STRUCT( TI )
TI.lpszText = const_cast< LPTSTR >( static_cast< LPCTSTR >( text )
);
if(IsWindow(m_wndToolTip) == FALSE)
{
m_wndToolTip.Create(this, TTS_ALWAYSTIP | TTS_NOPREFIX);
m_wndToolTip.SetMaxTipWidth(SHRT_MAX);
//Add tool
TI.uFlags = TTF_TRACK | TTF_TRANSPARENT;
m_wndToolTip.SendMessage(TTM_ADDTOOL, 0, (LPARAM)&TI);
}
else
{
//Modify the text of the tooltip.
m_wndToolTip.SendMessage(TTM_UPDATETIPTEXT, 0, (LPARAM)&TI);
}
//Take over the font from the dialog.
pfont = GetFont();
if(pfont != NULL)
{
m_wndToolTip.SetFont(pfont);
}
//Set the position of the tooltip.
pwndOK = GetDlgItem(IDOK);
pwndOK->GetWindowRect(&rectTemp);
m_wndToolTip.SendMessage(TTM_TRACKPOSITION,
0, (LPARAM)MAKELONG(rectTemp.left, rectTemp.top));
//Show tooltip
PREPARE_STRUCT( TI )
m_wndToolTip.SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&TI);
//Increment the static index
nIndex++;
}
void CToolTipTestDlg::OnOK()
{
ToolTipTest();
CDialog::OnOK();
}
</CODE>
If you give me a valid e-mail address, I can send you a copy of the
VC++ project.
MrAsm