473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Obtain no. of instances of an application from within the same app

Hi,

Is there a clever way to get the number of instances started of an
application within the same application. Is it possible to implement an event
handler to key on the change in numbers of running application of same type.
I saw this implemented in c++ with a static integer in the main section...

regards
Jesper.
Nov 17 '05 #1
2 1129
Hi Jesper,
you could use the System.Diagnostics.Process class and call
GetProcessesByName passing in the name of your process. This returns an
array ofpprocess informations, you could just count the number of items in
the list and thsis will tell you how many instances of your app are currently
running.

Hope that helps
Mark R Dawson
http://www.markdawson.org


"Jesper" wrote:
Hi,

Is there a clever way to get the number of instances started of an
application within the same application. Is it possible to implement an event
handler to key on the change in numbers of running application of same type.
I saw this implemented in c++ with a static integer in the main section...

regards
Jesper.

Nov 17 '05 #2
You can use Process.GetProcessByName and count the number of processes it
returns.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jesper" <Je****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
Hi,

Is there a clever way to get the number of instances started of an
application within the same application. Is it possible to implement an
event
handler to key on the change in numbers of running application of same
type.
I saw this implemented in c++ with a static integer in the main section...

regards
Jesper.

Nov 17 '05 #3

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

Similar topics

5
by: The Mighty Chaffinch | last post by:
I want to have 2 completely separate instances of my ASP/Access application running on the same web server. One will be a live production application, and the other part of a system test...
4
by: Tonya | last post by:
Hi, Does anyone have any example of how i can manage forms in my application?? I want to be able to reference my form instances that are currently open from other forms. why cant i open...
8
by: Frank DeLuccia | last post by:
Hello All, Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is;...
3
by: MW | last post by:
Hi all, I have written a windows service application and setup project to install/deinstall my service. There is a requirement to run one more instance of the same service with different set...
6
by: Angelos Karantzalis | last post by:
Hi y'all ... I'm a bit puzzled here about .NET class instancing under COM+ Issue 1: I've a COM+ component, let's call it ... COMDbWrapper that initializes itself from an xml file. The data...
3
by: Jim Frazer | last post by:
Hi, I'm new to C#, but experienced in C++. I'm converting an ActiveX object to C#. There is a single instance of a "primary" class which creates two collections of other "secondary" classes. ...
0
by: rbg | last post by:
Have a web application which uses Data Cache. I need to understand what happens when a new instance of the same web application is created for for serving concurrent clients. What happens when...
7
by: John Grandy | last post by:
It does not seem possible to compare instances of assemblies from which instances of controls/classes are created. In other words, if I have Assembly myAssembly Assembly.LoadFrom(path);...
8
by: ThunderMusic | last post by:
Hi, We need to serialize (binary) objects containing generic collections. The thing is, when we try to get the objects back (deserialize) with a different instance of the application, we receive...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.