Hi All :)
I'm writing my own
ToolTipMesssageBox
which has functionality close to that of message box but displays a tool tip instead.
I'm almost ready with this task and everything works fine except of a smal detail, the balloon always appears below the co-ordinates I give in the function (the co-ordinates of the point that's supposed to be pointed by the balloon's stem). The stem correctly points at the co-ordinates I give, but it sticks out of the upper edge of the balloon and thus the balloon is below the given point.
I examined MSDN and found no obvious way of controling this aspect of the balloon tooltip's appearance. Then I searched for articles in Code Project and found many, some of which show pictures of balloon tooltips that look exactly as I want:
Balloon Tips Galore![
^] (The first picture). But when I looked in the code I couldn't find anything that forces the balloon to appear this way, it looks like it's automatic.
I'd like to see the balloon normaly appearing above the provided point and appear below it only if there is not enough room for it above i.e. the point is too close to the upper edge of the desktop. Now it has exactly the oposite behaviour. (and covers some of my program's controls, which souldn't be a big problem since the balloon can easily dismissed, but still it would have been much better if ti appears above...)
I'm begining to fear that this is the way it is, and nothing can be done (except for writig a new balloon tool tip control from scratch, which I'm not willing to do), so any help is appreciated! :)
Thanks in advance.
Here the requested code sample :)
This is the code that creates the tool tip, it's in the OnCreate function of the transparent window that acts as parent of the tool tip control.
TOOLINFO ToolInfo;
LPARAM lParam;
CRect CtrlRect;
DWORD dwStyle = WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX | TTS_CLOSE |(AreBalloonsEnabled() ? TTS_BALLOON : 0);
m_wndToolTip.CreateEx(this, dwStyle, WS_EX_TOPMOST);
m_pwndCtrl->GetWindowRect(&CtrlRect);
m_pwndCtrl->GetParent()->ScreenToClient(&CtrlRect);
memset(&ToolInfo, 0, sizeof(ToolInfo));
ToolInfo.cbSize = sizeof(ToolInfo);
ToolInfo.uFlags = TTF_TRACK;
ToolInfo.hwnd = m_hWnd;
ToolInfo.uId = 1;
ToolInfo.rect = CtrlRect;
ToolInfo.lpszText = m_strText.GetString();
m_pwndCtrl->GetWindowRect(&CtrlRect);
lParam = LPARAM(CtrlRect.left + CtrlRect.Width() / 2);
lParam &= 0x0000ffff;
lParam |= LPARAM(CtrlRect.top + CtrlRect.Height() / 2 << 16);
m_wndToolTip.SendMessage(TTM_ADDTOOL, NULL, (LPARAM)&ToolInfo);
m_wndToolTip.SetTipBkColor(RGB(255, 255, 128));
m_wndToolTip.SetTitle(m_ttmbIcon, m_strTitle.GetString());
m_wndToolTip.SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&ToolInfo);
m_wndToolTip.SendMessage(TTM_TRACKPOSITION, 0, (LPARAM)lParam);