Hi,
is it possible with C#/.NET looking after previous instances of application,
or rather to check if previous instance is always running?
Thanks in advance,
Hubert 3 17043
Hi,
static void Main()
{
// get the name of our process
string proc=Process.Ge tCurrentProcess ().ProcessName;
// get the list of all processes by that name
Process[] processes=Proce ss.GetProcesses ByName(proc);
// if there is more than one process...
if (processes.Leng th > 1)
{
MessageBox.Show ("Applicatio n is already running");
return;
} else
Application.Run (new Form1());
}
Nirosh
"Hubert Hermanutz" <hh********@kav o.de> wrote in message
news:u9******** ******@TK2MSFTN GP12.phx.gbl... Hi,
is it possible with C#/.NET looking after previous instances of
application, or rather to check if previous instance is always running?
Thanks in advance, Hubert
Mutex
"Hubert Hermanutz" <hh********@kav o.de> wrote in message
news:u9******** ******@TK2MSFTN GP12.phx.gbl... Hi,
is it possible with C#/.NET looking after previous instances of
application, or rather to check if previous instance is always running?
Thanks in advance, Hubert
Hi Nirosh,
thank you, it works.
Regards,
Hubert
"Champika Nirosh" <no****@textcen tric.lk> schrieb im Newsbeitrag
news:ew******** ******@TK2MSFTN GP11.phx.gbl... Hi,
static void Main() { // get the name of our process string proc=Process.Ge tCurrentProcess ().ProcessName; // get the list of all processes by that name Process[] processes=Proce ss.GetProcesses ByName(proc); // if there is more than one process... if (processes.Leng th > 1) { MessageBox.Show ("Applicatio n is already running"); return; } else Application.Run (new Form1()); }
Nirosh
"Hubert Hermanutz" <hh********@kav o.de> wrote in message news:u9******** ******@TK2MSFTN GP12.phx.gbl... Hi,
is it possible with C#/.NET looking after previous instances of application, or rather to check if previous instance is always running?
Thanks in advance, Hubert
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 instance and have to instances of the same program
running togheter...
Can someone help me on this?
Fabio P.
|
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 for the "wrapper" was to get the scripts to run
with "root" privileges. So far so good. I simply create a "URL shortcut"
that some staff can...
|
by: ricky |
last post by:
I found the code below on how to check for a previous instance of an
app, but I don't think this will work for a network executeable. So,
how do you check to see if there is multiple instances of an
executeable running on a network?
Public Sub CheckForExistingInstance()
'Get number of processes of you program
If Process.GetProcessesByName...
|
by: Brian Tkatch |
last post by:
Is there a way to check the order in which SET INTEGRITY needs to be
applied? This would be for a script with a dynamic list of TABLEs.
B.
|
by: alexia.bee |
last post by:
Hi all,
In some weird reason, excel instance won;t die if i remove the comment
from 4 lines of setting values into struct.
here is a snipcode
public System.Collections.Generic.List<frmMain.sDBTest>
LoadTestSet(string TestSetFile,
System.Collections.Generic.List<frmMain.sDBTestDBviewList)
| |
by: =?Utf-8?B?Um9i?= |
last post by:
What is the C# command/function for checking to see if another instance of
the application is already running?
|
by: fniles |
last post by:
I am using VB.NET 2005. To check if the same program already run or not, I
can use the following
If Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length
MsgBox("Another instance of " & Process.GetCurrentProcess.ProcessName &
" is already running !")
End
End If
I am wondering if I can check the same thing for a thread.
|
by: Ben |
last post by:
Hi!
All of a sudden on a newer version of our application a check box on the
"Produce Invoice" form cannot be checked. I did not do any changes to this
form at all.
Below are the things that I know so far about the problem:
1. On the new version of the application the check box cannot be checked
2. On the previous version of the...
|
by: Jeff |
last post by:
I need a way to do the following and cannot seem to find a solution via
google.
1. Have a method from the main app to get all open forms
2. Check each open form for a public method
3. If this public method exists execute it which will result in the
displayed form being updated. There will be no data loss as the forms
will only contain...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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. ...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |