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. Change the content of a tooltip

Change the content of a tooltip

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studio
2 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.
  • S Offline
    S Offline
    Schehaider_Aymen
    wrote on last edited by
    #1

    Hi all, i was looking for a way to change the tooltip of the toolbar's buttons !! i tried to look for it on google but there is nothing versatile. I'm using Visual Studio 2005 and an MFC project !! Thank you

    "The Ultimate Limit Is Only Your Imagination."

    L 1 Reply Last reply
    0
    • S Schehaider_Aymen

      Hi all, i was looking for a way to change the tooltip of the toolbar's buttons !! i tried to look for it on google but there is nothing versatile. I'm using Visual Studio 2005 and an MFC project !! Thank you

      "The Ultimate Limit Is Only Your Imagination."

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I believe you would want to send TTM_DELTOOL message to your existing tooltip control to delete the current text, followed by a TTM_ADDTOOL message with the new text. Alternatively, I think you can use TTM_SETTOOLINFO to modify the text of an existing tooltip - that may be simpler. The following snippet shows the syntax for TTM_ADDTOOL and may point you in the right direction, although the code is WTL instead of MFC:

      TOOLINFO info;
      ZeroMemory(&info, sizeof(TOOLINFO));
      
      info.cbSize = sizeof(TOOLINFO);
      info.hinst = \_Module.get\_m\_hInst();
      info.uFlags = ( TTF\_CENTERTIP | TTF\_ABSOLUTE);
      info.lpszText = \_T("Your new text here.");
      
      m\_Toolbar.GetItemRect(m\_Toolbar.CommandToIndex(ID\_TOOLBAR\_BUTTON\_TO\_CHANGE ), &info.rect);
      info.hwnd = m\_Toolbar.m\_hWnd;
      info.uId = ID\_TOOLBAR\_BUTTON\_TO\_CHANGE;
      
      ::SendMessage(tt, TTM\_ADDTOOL, 0, (LPARAM)&info);// tt is the HWND of the tooltip control
      

      L u n a t i c F r i n g e

      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