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. MFC tray icon(please help)

MFC tray icon(please help)

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
4 Posts 4 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.
  • C Offline
    C Offline
    charu123
    wrote on last edited by
    #1

    Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give

    A K M 3 Replies Last reply
    0
    • C charu123

      Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give

      A Offline
      A Offline
      Aamir Butt
      wrote on last edited by
      #2

      Write a handler for WM_SYSCOMMAND and in it check nID. if it is SC_CLOSE, dont shut down the application, just hide it or minimize it to system tray, whatever you want to do. "I would luv to change the world, but they wont give me the source code" :( My Articles

      1 Reply Last reply
      0
      • C charu123

        Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give

        K Offline
        K Offline
        khan
        wrote on last edited by
        #3

        Just don't exit the application. Hide the main window when user wants to exit. Show it when user clicks on icon. --OR-- Write another app, which also has the same icon in the tray. Just a small app which never shows its interface, it is hidden. When user exits main app, it starts this small app before exiting. When user clicks on icon, this small app starts the main app, and exits itself. Good code for life.

        1 Reply Last reply
        0
        • C charu123

          Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          charu123 wrote: But i want the icon to remain in the systray even after i exit the application You can't do that. Tray icons work by sending window messages, so if your app exits there is no longer a window to send messages to. You'll need two apps, your main app, and one that's responsible for the tray icon. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

          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