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. tray icon tooltip text

tray icon tooltip text

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

    //Shell_NotifyIcon NOTIFYICONDATA notifyData; notifyData.cbSize = sizeof(notifyData); notifyData.hWnd = hwnd; notifyData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_STATE; notifyData.uCallbackMessage = MSG_STATUSICON; notifyData.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)); ::strcpy((char*)notifyData.szTip, "hello"); <-- not working ::strcpy((char*)notifyData.szInfo, "blablabla"); char tp [128] ; ::strcpy(tp,(char*)notifyData.szTip); //test tp gets "hello" value Shell_NotifyIcon(NIM_ADD, ¬ifyData); instead of hello im getting gibberish on my icon ToolTip ..long string looks like chinese. something wrong with this line? ::strcpy((char*)notifyData.szTip, "hello"); thank you

    D M 2 Replies Last reply
    0
    • A Adno

      //Shell_NotifyIcon NOTIFYICONDATA notifyData; notifyData.cbSize = sizeof(notifyData); notifyData.hWnd = hwnd; notifyData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_STATE; notifyData.uCallbackMessage = MSG_STATUSICON; notifyData.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)); ::strcpy((char*)notifyData.szTip, "hello"); <-- not working ::strcpy((char*)notifyData.szInfo, "blablabla"); char tp [128] ; ::strcpy(tp,(char*)notifyData.szTip); //test tp gets "hello" value Shell_NotifyIcon(NIM_ADD, ¬ifyData); instead of hello im getting gibberish on my icon ToolTip ..long string looks like chinese. something wrong with this line? ::strcpy((char*)notifyData.szTip, "hello"); thank you

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

      Lamefif wrote:

      notifyData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_STATE;

      What if you remove NIF_STATE?


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      A 1 Reply Last reply
      0
      • A Adno

        //Shell_NotifyIcon NOTIFYICONDATA notifyData; notifyData.cbSize = sizeof(notifyData); notifyData.hWnd = hwnd; notifyData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_STATE; notifyData.uCallbackMessage = MSG_STATUSICON; notifyData.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)); ::strcpy((char*)notifyData.szTip, "hello"); <-- not working ::strcpy((char*)notifyData.szInfo, "blablabla"); char tp [128] ; ::strcpy(tp,(char*)notifyData.szTip); //test tp gets "hello" value Shell_NotifyIcon(NIM_ADD, ¬ifyData); instead of hello im getting gibberish on my icon ToolTip ..long string looks like chinese. something wrong with this line? ::strcpy((char*)notifyData.szTip, "hello"); thank you

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        Lamefif wrote:

        something wrong with this line? ::strcpy((char*)notifyData.szTip, "hello");

        If it's a unicode build then yes, there's something wrong with that line :) I would recommend NOT using casts unless you need to. Write code without the casts. If the compiler complains, then investigate why. For a Unicode build, that line should be something like: // Unicode only ::wcscpy(notifyData.szTip, L"hello"); or better yet // generic _tcscpy(notifyData.szTip, _T("hello")); If this is indeed the problem, had you omitted the casts to char*, the compiler would have let you know. Mark -- modified at 14:23 Monday 16th July, 2007

        Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

        A 1 Reply Last reply
        0
        • D David Crow

          Lamefif wrote:

          notifyData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_STATE;

          What if you remove NIF_STATE?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          A Offline
          A Offline
          Adno
          wrote on last edited by
          #4

          no change..

          1 Reply Last reply
          0
          • M Mark Salsbery

            Lamefif wrote:

            something wrong with this line? ::strcpy((char*)notifyData.szTip, "hello");

            If it's a unicode build then yes, there's something wrong with that line :) I would recommend NOT using casts unless you need to. Write code without the casts. If the compiler complains, then investigate why. For a Unicode build, that line should be something like: // Unicode only ::wcscpy(notifyData.szTip, L"hello"); or better yet // generic _tcscpy(notifyData.szTip, _T("hello")); If this is indeed the problem, had you omitted the casts to char*, the compiler would have let you know. Mark -- modified at 14:23 Monday 16th July, 2007

            Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

            A Offline
            A Offline
            Adno
            wrote on last edited by
            #5

            thank you mark :)

            M 1 Reply Last reply
            0
            • A Adno

              thank you mark :)

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              You're welcome :) Also check out DavidCrow's reply...you are using a flag that indicates members of the struct are valid but you didn't show those members being initialized. Cheers, Mark

              Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

              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