Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Tracking Tooltips

Tracking Tooltips

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RadiumBall
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • R RadiumBall

      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

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      What was the problem with the MSDN code? Medication for us all You think you know me, well you're wrong

      R 1 Reply Last reply
      0
      • S Shog9 0

        What was the problem with the MSDN code? Medication for us all You think you know me, well you're wrong

        R Offline
        R Offline
        RadiumBall
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups