|
-
May 21st, 2013, 03:42 AM
#1
Thread Starter
Junior Member
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!
-
May 21st, 2013, 07:00 AM
#2
Re: Maximize an External Application which is minimized in the system tray using VB.N
you could use 2 api functions: findwindow + showwindow
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 21st, 2013, 07:33 AM
#3
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
-
May 21st, 2013, 08:06 AM
#4
Re: Maximize an External Application which is minimized in the system tray using VB.N
sorry. didn't read the question properly
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 21st, 2013, 08:30 AM
#5
Re: Maximize an External Application which is minimized in the system tray using VB.N
 Originally Posted by 4x2y
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.
-
May 21st, 2013, 08:34 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|