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 Icons

Tray Icons

Scheduled Pinned Locked Moved C / C++ / MFC
linuxquestion
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.
  • M Offline
    M Offline
    Marissa182
    wrote on last edited by
    #1

    Hi i have a dialog based app and im trying to add a tray icon i can get the icon to display but whenever you move the mouse into the tray it dissapears here is the code i have for it niData is stored in the class and is zeroed in the constructor void CWinDEDlg::InitTrayIcon() { niData.cbSize = sizeof(NOTIFYICONDATA); niData.uID = TRAY_ID; niData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP; niData.hIcon = (HICON)m_hIcon; niData.hWnd = (HWND)this; niData.uCallbackMessage = ICON_MESSAGE; Shell_NotifyIcon(NIM_ADD, &niData); } does anyone know why the icon just dissapears?

    I 1 Reply Last reply
    0
    • M Marissa182

      Hi i have a dialog based app and im trying to add a tray icon i can get the icon to display but whenever you move the mouse into the tray it dissapears here is the code i have for it niData is stored in the class and is zeroed in the constructor void CWinDEDlg::InitTrayIcon() { niData.cbSize = sizeof(NOTIFYICONDATA); niData.uID = TRAY_ID; niData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP; niData.hIcon = (HICON)m_hIcon; niData.hWnd = (HWND)this; niData.uCallbackMessage = ICON_MESSAGE; Shell_NotifyIcon(NIM_ADD, &niData); } does anyone know why the icon just dissapears?

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      I'm guessing it's because you've given the shell a zero length tooltip. Try removing the NIF_TIP flag. Though windows should just "shrug" and move on... Do you have a handler for ICON_MESSAGE? If so, does it get called before the icon disappears? Is your m_hIcon still valid? Iain.

      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