Hi Everyone,
I have a child window derived from CMDIChildWndEx named as CTestTooltipMdiChildWnd, on CTestTooltipMdiChildWnd titlebar, I have drawn a custom icon which is intially disabled.
When user mouse over on this custom icon, I should get a tooltip displayed.I get rect value of custom icon as below.
ti.rect = m_CustomIconInfo.m_testBtn;
I tried writting code on OnNcHitTest(CPOINT point) as below. I am not able to see tooltip getting displayed.
Can anybody suggest If I have missed anything in coding.
LRESULT CTestTooltipMdiChildWnd::OnNcHitTest(CPoint point)
{
HWND hwndTT = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
m_hWnd, NULL, GetModuleHandle(0),NULL);
::SendMessage(hwndTT,TTM_ACTIVATE,TRUE,0);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND;
ti.hwnd = m_hWnd;
ti.uId = (UINT)m_hWnd;
ti.hinst = GetModuleHandle(0);
ti.rect = m_CustomIconInfo.m_testBtn;
ti.lpszText = TEXT("This is your tooltip string.");;
:: SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
::SendMessage(hwndTT,TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti);
}
Regards,
Joy
What I have tried:
Written Code in OnHitTest(CPoint) as below.
HWND hwndTT = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
m_hWnd, NULL, GetModuleHandle(0),NULL);
::SendMessage(hwndTT,TTM_ACTIVATE,TRUE,0);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND;
ti.hwnd = m_hWnd;
ti.uId = (UINT)m_hWnd;
ti.hinst = GetModuleHandle(0);
ti.rect = m_CustomCaptionInfo.m_testBtn;
ti.lpszText = TEXT("This is your tooltip string.");;
:: SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
::SendMessage(hwndTT,TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti);