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. Visual Basic
  4. Icon in system tray (Notify Icon)

Icon in system tray (Notify Icon)

Scheduled Pinned Locked Moved Visual Basic
questionhelp
3 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.
  • B Offline
    B Offline
    Bruno Lemos
    wrote on last edited by
    #1

    Hi all! I made a simple Windows Application (MyApp.exe) that shows a simple form with the system date. That application adds an icon to the system tray (a notify icon) that has associated to it a simple context Menu (Exit). So far no problems... My problem is: If i run MyApp.exe 2,3,4 or n times it adds 2,3,4,n icons to the system tray :confused: :( How can i prevent this in order to if i had already the icon of MyApp in the system tray, and if i click on MyApp.exe the focus goes to the form of MyApp and don't add a new icon to system tray?? :confused: Thanx in advance

    R 1 Reply Last reply
    0
    • B Bruno Lemos

      Hi all! I made a simple Windows Application (MyApp.exe) that shows a simple form with the system date. That application adds an icon to the system tray (a notify icon) that has associated to it a simple context Menu (Exit). So far no problems... My problem is: If i run MyApp.exe 2,3,4 or n times it adds 2,3,4,n icons to the system tray :confused: :( How can i prevent this in order to if i had already the icon of MyApp in the system tray, and if i click on MyApp.exe the focus goes to the form of MyApp and don't add a new icon to system tray?? :confused: Thanx in advance

      R Offline
      R Offline
      Rickard Andersson20
      wrote on last edited by
      #2

      You just check if your app allready is running with eg. ::FindWindow(...) (you need to P/Invoke it) Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

      K 1 Reply Last reply
      0
      • R Rickard Andersson20

        You just check if your app allready is running with eg. ::FindWindow(...) (you need to P/Invoke it) Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

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

        Rather than using the FindWindow API, there is a nice .NET way to find out if your app is already running. If UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then If this returns true then there is another instance of the process running. What I haven't had time to work out yet is how to activate that existing instance. So if anyone knows off the top of their head how to do that, please comment. I've done plenty of this stuff with API calls in VB6 but I'd prefer to use native .NET as much as possible now. cya, Kermitt

        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