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. Add tool tip to menu

Add tool tip to menu

Scheduled Pinned Locked Moved C / C++ / MFC
6 Posts 5 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.
  • N Offline
    N Offline
    NoviceEx
    wrote on last edited by
    #1

    Does anyone know how possible this one was made (this is link to picture): https://i.ibb.co/nCrT1Ty/howtodothis.png[^] Maybe someone has samples of similar project or link to such project. Thanks.

    L D L N 4 Replies Last reply
    0
    • N NoviceEx

      Does anyone know how possible this one was made (this is link to picture): https://i.ibb.co/nCrT1Ty/howtodothis.png[^] Maybe someone has samples of similar project or link to such project. Thanks.

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

      Yes lots of samples can be found: msdn: C tooltip - Google Search[^].

      1 Reply Last reply
      0
      • N NoviceEx

        Does anyone know how possible this one was made (this is link to picture): https://i.ibb.co/nCrT1Ty/howtodothis.png[^] Maybe someone has samples of similar project or link to such project. Thanks.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Try: CListCtrl and Displaying a Tooltip[^] MFC List Control with Tooltip and Menu Ability[^]

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        1 Reply Last reply
        0
        • N NoviceEx

          Does anyone know how possible this one was made (this is link to picture): https://i.ibb.co/nCrT1Ty/howtodothis.png[^] Maybe someone has samples of similar project or link to such project. Thanks.

          L Offline
          L Offline
          leon de boer
          wrote on last edited by
          #4

          It's easy to add to any window using just the Windows API .. So you have a window Handle (hWnd) and you have a char* tooltip you wish to display First you must make sure commoncontrols is kicked

          #include
          #pragma comment(lib, "comctl32.lib") // Shortcut to add library rather than manual add

          INITCOMMONCONTROLSEX icex = {
          .dwSize = sizeof(INITCOMMONCONTROLSEX),
          .dwICC = ICC_STANDARD_CLASSES
          };
          InitCommonControlsEx(&icex);

          Now create the tooltip window .. we will default to same area as window itself you can size it if you want

          HWND TTWnd = CreateWindowEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
          WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_BALLOON,
          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
          hWnd, 0, 0, NULL); // Create tooltip window

          if (TTWnd) // Tooltip window successfully created
          {
          TOOLINFO ti = { 0 };
          SetWindowPos(TTWnd, HWND_TOPMOST, 0, 0, 0, 0,
          SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); // Set window position
          ti.cbSize = sizeof(TOOLINFO); // Size of structure
          ti.uFlags = TTF_SUBCLASS; // Class
          ti.hwnd = hWnd; // Parent window is YOUR HANDLE OF YOUR WINDOW
          ti.hinst = 0; // This instance
          ti.uId = 0; // No uid
          ti.lpszText = tooltip; // YOUR TOOLTIP text pointer
          GetClientRect(hWnd, &ti.rect); // Tooltip to cover whole window
          SendMessage(TTWnd, TTM_ADDTOOL, 0, (LPARAM)&ti); // Send message adding tooltip to window
          }

          Try it on any window you like :-)

          In vino veritas

          1 Reply Last reply
          0
          • N NoviceEx

            Does anyone know how possible this one was made (this is link to picture): https://i.ibb.co/nCrT1Ty/howtodothis.png[^] Maybe someone has samples of similar project or link to such project. Thanks.

            N Offline
            N Offline
            NoviceEx
            wrote on last edited by
            #5

            First of all I cannot use MFC. I have made WM_MENUSELECT handling in the dialog: case WM_MENUSELECT: return OnMyMenuSelect(LOWORD(wpar), HIWORD(wpar), (HMENU)lpar); However function IsMenu((HMENU)lpar) returns FALSE. Does anybody has idea why ?

            P 1 Reply Last reply
            0
            • N NoviceEx

              First of all I cannot use MFC. I have made WM_MENUSELECT handling in the dialog: case WM_MENUSELECT: return OnMyMenuSelect(LOWORD(wpar), HIWORD(wpar), (HMENU)lpar); However function IsMenu((HMENU)lpar) returns FALSE. Does anybody has idea why ?

              P Offline
              P Offline
              phil o
              wrote on last edited by
              #6

              NoviceEx wrote:

              However function IsMenu((HMENU)lpar) returns FALSE. Does anybody has idea why ?

              Did you try to debug this function? This would allow you to know why it returns false.

              noop()

              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