Transparent tooltip gets focus with the manifest-style under Windows XP

  • Thread starter Thread starter Johannes Ody
  • Start date Start date
J

Johannes Ody

A Tooltip with TTF_TRANSPARENT and TTF_TRACK tool gets the focus, if I used
under Windows XP the
manifest-style and click with the mouse on the tooltip. But I want, that the
tooltip dispaths
the messages to the window, that is under the tooltip. I have searched in
the world wide web about
this problem, but did not found other persons with the same problem. I have
tested other
example-applications from www.codeproject.com, with a litle modification
(the tooltip was only
shown, but not hidden) and the tested applications have the same problem. I
don't know, how Microsoft
use in the VC6.0 in the Workarea-Window also an tooltip-window, because they
haven't the same problem.

The following source-code is from my test-application. The program is a
simple MFC-dialog-program,
the dialog includes an OK- and Cancel-button. m_wndToolTip is from
CToolTipCtrl.
void CTooltiptestDlg::OnOK()
{
TOOLINFO TI;
char caText[1024];
static long nIndex = 0;
CRect rectTemp;
CFont* pfont;
CWnd* pwndOK;

memset(&TI, 0, sizeof(TI));
TI.cbSize = sizeof(TI);
sprintf(caText, "nIndex=%d", nIndex);
TI.lpszText = caText;

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
memset(&TI, 0, sizeof(TI));
TI.cbSize = sizeof(TI);
m_wndToolTip.SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&TI);

//Increment the static index
nIndex++;
}
I haven't called the CToolTipCtrl::RelayEvent-function in
CWnd::PreTranslateMessage, because the tool
is added with TTF_TRANSPARENT and TTF_TRACK, position with TTM_TRACKPOSITION
and showed with
TTM_TRACKACTIVATE.

Can anybody help me???
Johannes Ody
 
Back
Top