Results 1 to 6 of 6

Thread: Maximize an External Application which is minimized in the system tray using VB.Net

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2011
    Posts
    25

    Smile Maximize an External Application which is minimized in the system tray using VB.Net

    Hi Guys!

    I do have a problem which involves my current project. I already had the codes to switch the program in the system tray after it was minimized and vice versa. The problem is if I run again another instance of the same program, I do want the current instance to be maximized and then disregard the new instance to be run. A good example that I can relate was the Yahoo Messenger App. In Yahoo Messenger App, if there is a current instance running and then you tried to run another, the current instance will be pulled out on the system tray and show it on its normal state. It is exactly what I wanted to do.

    If anyone here knows how to do it, Please I need your help.

    Thanks in advance guys!

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,414

    Re: Maximize an External Application which is minimized in the system tray using VB.N

    you could use 2 api functions: findwindow + showwindow

  3. #3
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Maximize an External Application which is minimized in the system tray using VB.N

    VB.NET has an option to make single instance application, do the following
    1- Go to the menu Project> prj_name Properties...
    2- In the application tab select the option "Make single instance application"
    3- In the application tab press a button labeled with "View Application Events"
    4- A module named "ApplicationEvents.vb" will open, paste the following inside it
    Code:
            Private Sub MyApplication_StartupNextInstance(sender As Object, e As ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
                Form1.Show() ' replace Form1 with the name of your main form.
            End Sub



  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,414

    Re: Maximize an External Application which is minimized in the system tray using VB.N

    sorry. didn't read the question properly

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Maximize an External Application which is minimized in the system tray using VB.N

    Quote Originally Posted by 4x2y View Post
    VB.NET has an option to make single instance application, do the following
    1- Go to the menu Project> prj_name Properties...
    2- In the application tab select the option "Make single instance application"
    3- In the application tab press a button labeled with "View Application Events"
    4- A module named "ApplicationEvents.vb" will open, paste the following inside it
    Code:
            Private Sub MyApplication_StartupNextInstance(sender As Object, e As ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
                Form1.Show() ' replace Form1 with the name of your main form.
            End Sub
    Don't you want Me.Show instead of FormName.Show.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Maximize an External Application which is minimized in the system tray using VB.N

    Don't you want Me.Show instead of FormName.Show.
    No you cannot use Me keyword because that line is in a different module.

    Edit:
    The following is better
    Code:
            Private Sub MyApplication_StartupNextInstance(sender As Object, e As ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
                My.Application.MainForm.Show()
            End Sub
    Last edited by 4x2y; May 21st, 2013 at 08:43 AM.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width