How could I check if my app is running.
I would like to check if my app is running for specified user, because it is
used in Terminal Server.
I want the program to somehow check if another copy is running for the user,
and if so to display a warning message, them exit.
TIA 8 3897
Nikolay,
I don't know it in a Terminal Server this is the easiest one without, which
prevents however as well other programs with the same name to run.
\\\
Private mutCreated as Boolean
Private mut As New Threading.Mutex(True, "myProgram", mutCreated)
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not mutCreated Then Me.Close()
'etc
End Sub
///
I hope this helps?
Cor
Nikolay,
I don't know it in a Terminal Server this is the easiest one without, which
prevents however as well other programs with the same name to run.
\\\
Private mutCreated as Boolean
Private mut As New Threading.Mutex(True, "myProgram", mutCreated)
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not mutCreated Then Me.Close()
'etc
End Sub
///
I hope this helps?
Cor
the method with the mutex is ok
but don't work in Terminal Server, because when one user run the program,
others can't
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eJ**************@TK2MSFTNGP14.phx.gbl... Nikolay,
I don't know it in a Terminal Server this is the easiest one without, which prevents however as well other programs with the same name to run.
\\\ Private mutCreated as Boolean Private mut As New Threading.Mutex(True, "myProgram", mutCreated) Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load If Not mutCreated Then Me.Close() 'etc End Sub /// I hope this helps?
Cor
the method with the mutex is ok
but don't work in Terminal Server, because when one user run the program,
others can't
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eJ**************@TK2MSFTNGP14.phx.gbl... Nikolay,
I don't know it in a Terminal Server this is the easiest one without, which prevents however as well other programs with the same name to run.
\\\ Private mutCreated as Boolean Private mut As New Threading.Mutex(True, "myProgram", mutCreated) Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load If Not mutCreated Then Me.Close() 'etc End Sub /// I hope this helps?
Cor
Here's the routine I use for checking if another copy is currently
running. Not sure if this returns a false positive if another user on a
terminal server is running it though.
Function PrevInstance() As Boolean
If UBound( _
Diagnostics.Process.GetProcessesByName( _
Process.GetCurrentProcess.ProcessName)) > 0 Then
Return True
End
Else
Return False
End If
End Function
Hope this helps,
Brian Swanson
"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:jo**************@mail.bg: How could I check if my app is running.
I would like to check if my app is running for specified user, because it is used in Terminal Server.
I want the program to somehow check if another copy is running for the user, and if so to display a warning message, them exit.
TIA
Here's the routine I use for checking if another copy is currently
running. Not sure if this returns a false positive if another user on a
terminal server is running it though.
Function PrevInstance() As Boolean
If UBound( _
Diagnostics.Process.GetProcessesByName( _
Process.GetCurrentProcess.ProcessName)) > 0 Then
Return True
End
Else
Return False
End If
End Function
Hope this helps,
Brian Swanson
"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:jo**************@mail.bg: How could I check if my app is running.
I would like to check if my app is running for specified user, because it is used in Terminal Server.
I want the program to somehow check if another copy is running for the user, and if so to display a warning message, them exit.
TIA
Brian,
"Brian Swanson" <pu*******@gREMOVETHISmail.com> schrieb: Here's the routine I use for checking if another copy is currently running. Not sure if this returns a false positive if another user on a terminal server is running it though.
Function PrevInstance() As Boolean If UBound( _ Diagnostics.Process.GetProcessesByName( _ Process.GetCurrentProcess.ProcessName)) > 0 Then Return True End Else Return False End If End Function
Notice that process names are not necessarily unique, so there can be
different applications with the same process name.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Brian,
"Brian Swanson" <pu*******@gREMOVETHISmail.com> schrieb: Here's the routine I use for checking if another copy is currently running. Not sure if this returns a false positive if another user on a terminal server is running it though.
Function PrevInstance() As Boolean If UBound( _ Diagnostics.Process.GetProcessesByName( _ Process.GetCurrentProcess.ProcessName)) > 0 Then Return True End Else Return False End If End Function
Notice that process names are not necessarily unique, so there can be
different applications with the same process name.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Amrik Singh |
last post by:
HI folks can anyone help a newbie here.
I would like to know how I can check if my software is already running.
So that if the user click s on the shortcut to start the progam again
it maximises...
|
by: Fabio Pliger |
last post by:
Hi,
is it possibile, in python, to check for an already running instance of an
application?
My problem is that, if my program i running and the user relaunch it, i
don't want to open a new...
|
by: Pierre-Yves |
last post by:
Hello,
I would like to prevent my perl program to be executed several times
simultaneously (if the program is already running, I would like to display a
message like "another instance of this...
|
by: Nick Sinclair |
last post by:
Hi all,
I'm new to C.
I have successfully written a small C program that acts as a "wrapper"
around cgi scripts. These scripts perform admin tasks such as backing up
etc. Obviously, The need...
|
by: Brian Henry |
last post by:
I want to make a schedule of events to occur in a windows service (kinda
like a scheduler) so the user can specify through an external interface to
do a task at a certain time... like this
8pm -...
|
by: Nikolay Petrov |
last post by:
How could I check if my app is running.
I would like to check if my app is running for specified user, because it is
used in Terminal Server.
I want the program to somehow check if another...
|
by: tshad |
last post by:
What would be a good way to check programmatically whether a service was
running?
We have a service that dies periodically and I need to check to see if this
service is running. I know how to...
|
by: Venky K Shankar |
last post by:
On Sunday 20 July 2008 12:08:49 am Lamonte Harris wrote:
you can execute OS system call.
here i execute ps -ef and grep the required process name (or you can grep by
pid on that particular...
|
by: Shadlan |
last post by:
Hi.
I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |