Tracking Tooltips
-
Hello Everyone, Can someone please tell a way to create tracking tooltip. Please note I have already tried the MSDN Libary tracking tooltips code, but failed to achieve the objective. Kindly help. Regars Ashwin
-
Hello Everyone, Can someone please tell a way to create tracking tooltip. Please note I have already tried the MSDN Libary tracking tooltips code, but failed to achieve the objective. Kindly help. Regars Ashwin
-
What was the problem with the MSDN code? Medication for us all You think you know me, well you're wrong
Hello Thanks for the Reply, Have you tried the code. If so please paste your function here, I would be very much greatful to you. As far as my try goes I do get a tracking rectangle follwing my mouse but it keeps blinking all the time I move the mouse and without the text I pasted in the code. bool g_bIsVisible; HWND g_hwndTT; void CTestDlg::TooltipFunc() { INITCOMMONCONTROLSEX icex; HWND hwndTT; TOOLINFO ti; // Load the tooltip class from the DLL. icex.dwSize = sizeof(icex); icex.dwICC = ICC_BAR_CLASSES; if(!InitCommonControlsEx(&icex)) return NULL; RECT rect; GetClientRect (&rect); // Create the tooltip control. hwndTT = CreateWindow(TOOLTIPS_CLASS, TEXT(""), WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, (HMENU)NULL, AfxGetApp()->m_hInstance, NULL); // Prepare TOOLINFO structure for use as tracking tooltip. ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE; ti.hwnd = m_hWnd; ti.uId = (UINT)m_hWnd; ti.hinst = AfxGetApp()->m_hInstance; ti.lpszText = "Hello World"; ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0; // Add the tool to the control, displaying an error if needed. if(!::SendMessage(hwndTT,TTM_ADDTOOL,0,(LPARAM)&ti)){ MessageBox("Couldn't create the tooltip control.", "Error",MB_OK); return NULL; } // Activate (display) the tracking tooltip. Then, set a global // flag value to indicate that the tooltip is active, so other // functions can check to see if it's visible. ::SendMessage(hwndTT,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti); g_bIsVisible = TRUE; g_hwndTT = hwndTT; } void CTestDlg::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(g_bIsVisible){ #define X_OFFSET 15 #define Y_OFFSET X_OFFSET POINT m_point; ::GetCursorPos(&m_point); ::SendMessage(g_hwndTT, TTM_TRACKPOSITION, 0, (LPARAM)MAKELPARAM(m_point.x + X_OFFSET, m_point.y + Y_OFFSET)); } CDialog::OnMouseMove(nFlags, point); } BOOL CTestDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESU