473,626 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System tray help

Hi all.

I am having application in vb.net.

I am having module and one form. From module i am opening form.
On main itself i am checking whether another instance of application is
running or not. I am also providing faclity of minimizing application
to system tray.
What i want is after clicking on exe of my application, it should check
whether my app is already running or not. If yes i don;t want to create
new instance but want to bring current instance in focus(that is
maxmimzing current application which is there is system tray).

Does any one is having any idea about it.
Please help me.
Thanks in advance.

Nov 21 '05 #1
8 2389
Try this:

http://www.planet-source-code.com/vb...3585&lngWId=10

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Hi.
thanks for your reply.
But i want currently running process to be in focus.
I used process class to find out whethere there is any instance of
application running or not. And if yes i want to maximize that
application. My problem is when my application is in system tray
through another application i want that application to be maximised. I
am not getting how to set that application in foreground.
Please help me if you know anything about this.
Thanks.

Nov 21 '05 #3
Hi,
You can use FindWindow API function to find main window of previous
instance, and call ShowWindow with SW_SHOWMAXIMIZE D.

<tr************ **@yahoo.com> ???????/???????? ? ???????? ?????????:
news:11******** *************@g 49g2000cwa.goog legroups.com...
Hi.
thanks for your reply.
But i want currently running process to be in focus.
I used process class to find out whethere there is any instance of
application running or not. And if yes i want to maximize that
application. My problem is when my application is in system tray
through another application i want that application to be maximised. I
am not getting how to set that application in foreground.
Please help me if you know anything about this.
Thanks.

Nov 21 '05 #4
Hi once again.
thanks for you help.

can you tell me how to use findwindow in vb.net application.

Thanks in advance.

Nov 21 '05 #5
<tr************ **@yahoo.com> ???????/???????? ? ???????? ?????????:
news:11******** *************@g 49g2000cwa.goog legroups.com...
Hi once again.
thanks for you help.

can you tell me how to use findwindow in vb.net application.

Thanks in advance.


Hi,
How to use it? Like you use it in non-vb .net applications:
~
Private Declare Function FindWindow Lib "user32.dll " Alias "FindWindow A"
(ByVal lpClassName As IntPtr, ByVal lpWindowName As String) As IntPtr
....
Dim myWindowHandle as IntPtr = FindWindow(New IntPtr(0), "Your main window
title goes here")
~
If you are not sure if there isn't another window with same caption you can
replace "lpClassNam e As IntPtr" with "lpClassNam e As String" and "New
IntPtr(0)" with "WindowsForms10 .Window.8.app3" (VB .NET forms' window
class), so you won't activate a non-.NET application instead of yours.
Nov 21 '05 #6
I wouldn't use IntPtr myself, but convert it to Integer instead

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #7
This code will take a program minimized into the system tray and restore it
to the screen with the focus instead of opening a new window.

Bobbo
_______________ _______________ ____________
Public Class Form1
Inherits System.Windows. Forms.Form

Declare Auto Function FindWindow Lib "user32.dll " _
(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr

Declare Auto Function ShowWindow Lib "user32.dll " _
(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean

#Region " Windows Form Designer generated code "
#End Region

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Const SW_RESTORE As Integer = 9
Dim SearchText As String = Me.Text
If UBound(System.D iagnostics.Proc ess.GetProcesse sByName( _
System.Diagnost ics.Process.Get CurrentProcess. ProcessName)) > 0 Then
Me.Text = Me.Text & "X"
Dim Handle As IntPtr = FindWindow(Noth ing, SearchText)
ShowWindow(Hand le, SW_RESTORE)
End
End If
End Sub
End Class
Nov 21 '05 #8
Hi
thanks for your reply.
But this solution is not working in my case.
Because i have main from which i am displaying main form.
And in main sub itself i want to check whether previous instance of my
application is runnign or not.
And in main i am not able to set me.text property. Because i haven;t
created object of my form at the begining.
So can u tell me without chaging text of form restoring previous
instance.

Please help me.

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
6952
by: none | last post by:
Hello all, I wrote a shell program a few years ago in VB6 that needs to be modified. The problem I have is this: The SysAdmin uses this shell in place of Explorer, so there is no taskbar. When his users run PC Anywhere from the shell, and minimize it, it minimizes to the system tray. With no task bar, there is no system tray, so there is no way to restore the PC Anywhere window. The shell starts PC Anywhere using ShellExecute. I...
5
3032
by: BJ | last post by:
I am trying to add my application to the system tray. I am not using the built in control becuase of the limitation that you can not use the balloon tool tip feature. I have done this succesfully in vb6 but when I try it in vb.net I get the system tray to work but there is no icon in the system tray. I know it is working because I can get the balloon tip to appear and where the icon is supposed to be there just isn't an icon. just a blank...
4
5644
by: Tom | last post by:
Hello, System tray icon informs users that the apps is running in the background. However, there are instances that the app might crash and after that the app icon in the system tray is still displayed. It goes away when the mouse is pointed over the icon. I wonder if there is any way to force system tray refresh during the VB.NET app crash? I tried to add some code in the finalize but it didn't do anything. I think
10
3124
by: Crouchie1998 | last post by:
Hello To All You Real Programmers Out There!! There is an application called: "Tray It" Webpage: ---------- http://www.teamcti.com/trayit/trayit.htm Direct Download:
5
6121
by: scottt | last post by:
I asked a question along a similar line about a week ago and didn't get any replies. Let me try to ask the quetion again a little bit different to see if I can get some help on this problem. Is there a way (API function) from one program to restore another application that is running in the system tray? Specifically I need to send a double mouse click to the application to get it to restore from the system tray. Thanks.
5
9816
by: bipi | last post by:
Dear everyone, In my application, I kill process by: private bool KillProcess(String processName) { bool result = false; Process process = Process.GetProcessesByName(processName); for (int i = 0; i < process.Length; i++)
2
3912
by: ericlangland | last post by:
Hi, I have a small managed code application (windows forms) that executes on startup and immidiatly minimizes to the system tray. It launches and shows the form when I double click it's small icon in the system tray. So far so good. I'd like for the app to maximize outside of the system tray when the Windows + ? combination keys are selected. It seems that I can catch keystrokes when the form is showing but when minimized(Hide()) it in...
3
4703
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hi, I have created a System Tray application using C# for .NET 2.0. My PC will not shut down or make a restart if my System Tray application is working at the Tray. Only after I end the process of my System Tray application then my PC is able to do a shut down or Restart. Any help for solving this problem will be much appreciated.
3
7921
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory but the tray icon is not there. If I start the program after Windows has booted up the icon shows every time. I am assuming that the reason is due to the icon being created before the system tray is loaded/running. I have used a timer with...
3
3309
by: Usman Jamil | last post by:
Hi I've a windows application that does a lengthy backup process. While the process is going on, I need to show a progress bar inside system tray or just above the system tray. Can someone please guide me how to show the progress bar out of the boundaries of the application form area and near the system tray. Regards Usman
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.