473,570 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running multiple instances of a program

I just finished a WinForms app in VB.NET. I want to allow the user to be
able to run multiple instances of the program like you can with Notepad and
Wordpad. The way it is now, once I run the executable I can not run another
instance as long as the first instance is running. How can I change this
behavior? Thanks.
Nov 20 '05 #1
11 20888
* "Clark Stevens" <cy*********@ho tmail.com> scripsit:
I just finished a WinForms app in VB.NET. I want to allow the user to be
able to run multiple instances of the program like you can with Notepad and
Wordpad. The way it is now, once I run the executable I can not run another
instance as long as the first instance is running. How can I change this
behavior?


What you want to do is the default behavior. Preventing the application
from running more than once would require additional code.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #2
Clark,

The default is to allow you to run as many instances as you want.

Create a small test project with 1 form. Run the project in Visual Studio
so the bin directory is created and the .exe is built.

Exit Visual Studio and navigate to the projects bin directory.

Double-Click the .exe and observe the form displays.

Double-Click the .exe again and observe a second form displays.

....

-Sam Matzen
"Clark Stevens" <cy*********@ho tmail.com> wrote in message
news:yE******** ***********@twi ster.nyroc.rr.c om...
I just finished a WinForms app in VB.NET. I want to allow the user to be
able to run multiple instances of the program like you can with Notepad and Wordpad. The way it is now, once I run the executable I can not run another instance as long as the first instance is running. How can I change this
behavior? Thanks.

Nov 20 '05 #3
"Samuel L Matzen" <sm*****@slm.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Clark,

The default is to allow you to run as many instances as you want.

Create a small test project with 1 form. Run the project in Visual Studio
so the bin directory is created and the .exe is built.

Exit Visual Studio and navigate to the projects bin directory.

Double-Click the .exe and observe the form displays.

Double-Click the .exe again and observe a second form displays.


Okay, I did this and it does run multiple instances. However, I have setup
a shortcut on the desktop which launches the executable in the program's Bin
directory. It is the shortcut that doesn't seem to allow the multiple
instances. Every time I launch the shortcut it doesn't run another instance
of the executable. Is there some settings on the shortcut that I need to
change or something?
Nov 20 '05 #4
Clark,

I just created a shortcut and it creates multiple instances.

I can't find anything about a shortcut that would make the application not
launch multiple times.

-Sam Matzen
"Clark Stevens" <cy*********@ho tmail.com> wrote in message
news:cw******** ***********@twi ster.nyroc.rr.c om...
"Samuel L Matzen" <sm*****@slm.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Clark,

The default is to allow you to run as many instances as you want.

Create a small test project with 1 form. Run the project in Visual Studio so the bin directory is created and the .exe is built.

Exit Visual Studio and navigate to the projects bin directory.

Double-Click the .exe and observe the form displays.

Double-Click the .exe again and observe a second form displays.
Okay, I did this and it does run multiple instances. However, I have

setup a shortcut on the desktop which launches the executable in the program's Bin directory. It is the shortcut that doesn't seem to allow the multiple
instances. Every time I launch the shortcut it doesn't run another instance of the executable. Is there some settings on the shortcut that I need to
change or something?

Nov 20 '05 #5

"Samuel L Matzen" <sm*****@slm.co m> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Clark,

I just created a shortcut and it creates multiple instances.

I can't find anything about a shortcut that would make the application not
launch multiple times.


I figured out what is causing this. I have a keyboard shortcut defined for
the shortcut on the desktop. When I press the corresponding keyboard
shortcut it launches the executable as expected. However, when I press the
keyboard shortcut a second time it will not launch again. I can launch
another instance by going to the desktop and double clicking on the
shortcut, but pressing the assigned keyboard shortcut multiple times will
not work. Can you duplicate this?
Nov 20 '05 #6
Clark,

* "Clark Stevens" <cy*********@ho tmail.com> scripsit:
I just created a shortcut and it creates multiple instances.

I can't find anything about a shortcut that would make the application not
launch multiple times.


I figured out what is causing this. I have a keyboard shortcut defined for
the shortcut on the desktop. When I press the corresponding keyboard
shortcut it launches the executable as expected. However, when I press the
keyboard shortcut a second time it will not launch again. I can launch
another instance by going to the desktop and double clicking on the
shortcut, but pressing the assigned keyboard shortcut multiple times will
not work. Can you duplicate this?


I am able to duplicate this and I think this behavior is "by design".
If the application is not yet started and you press the keyboard
shortcut assigned to the shell link pointing to the application, the
application will be started. If the application is already running and
the shortcut is pressed, the running instance is activated. That's what
the help popup for the shortcut field in the shell link's properties
dialog box is saying.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #7
Clark,

Yes, I have observed the behavior you described. You apparently cannot
launch multiple instances with the shortcut key.

-Sam Matzen
"Clark Stevens" <cy*********@ho tmail.com> wrote in message
news:4U******** ***********@twi ster.nyroc.rr.c om...

"Samuel L Matzen" <sm*****@slm.co m> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Clark,

I just created a shortcut and it creates multiple instances.

I can't find anything about a shortcut that would make the application not launch multiple times.
I figured out what is causing this. I have a keyboard shortcut defined

for the shortcut on the desktop. When I press the corresponding keyboard
shortcut it launches the executable as expected. However, when I press the keyboard shortcut a second time it will not launch again. I can launch
another instance by going to the desktop and double clicking on the
shortcut, but pressing the assigned keyboard shortcut multiple times will
not work. Can you duplicate this?

Nov 20 '05 #8
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ui******** ******@tk2msftn gp13.phx.gbl...
I am able to duplicate this and I think this behavior is "by design".
If the application is not yet started and you press the keyboard
shortcut assigned to the shell link pointing to the application, the
application will be started. If the application is already running and
the shortcut is pressed, the running instance is activated. That's what
the help popup for the shortcut field in the shell link's properties
dialog box is saying.


Got it. So I guess there's no way to directly load multiple instances of
the same app using a shortcut key. Hmmm, I really need this capability, so
I'll have to figure something else out. Well, anyway, thanks for your help.
I appreciate it.
Nov 20 '05 #9
Create a .CMD script with the following lines in it and associate the
shortcut and shortcut key to your script:

start "path\myapp.exe "
exit

Now your application will be indirectly started each time you press the
shortcut key.

Mike Ober.

"Clark Stevens" <cy*********@ho tmail.com> wrote in message
news:BH******** ***********@twi ster.nyroc.rr.c om...
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ui******** ******@tk2msftn gp13.phx.gbl...
I am able to duplicate this and I think this behavior is "by design".
If the application is not yet started and you press the keyboard
shortcut assigned to the shell link pointing to the application, the
application will be started. If the application is already running and
the shortcut is pressed, the running instance is activated. That's what
the help popup for the shortcut field in the shell link's properties
dialog box is saying.
Got it. So I guess there's no way to directly load multiple instances of
the same app using a shortcut key. Hmmm, I really need this capability,

so I'll have to figure something else out. Well, anyway, thanks for your help. I appreciate it.

Nov 20 '05 #10

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

Similar topics

1
4086
by: Bruce | last post by:
I am writing an installer that needs to put a dll file with a bunch of extended stored procedures in the BINN directory. The problem is that if the machine is running multiple instances of SQL Server, there is more than one BINN directory. The installer has a dynamically populated dropdown with the name of the instances, so does anyone know...
4
10154
by: PalB | last post by:
How to stop running multiple instances of my App in C#? Thanx
1
2968
by: sunil | last post by:
Hello All. I have written a program as an exe that performs some kind of order processing. The program is first configured and then started manually. I have have multiple instances of this program with their own ini file and multiple instances can run simultaneouly. Now what i want to convert the whole thing into a windows ervice that is...
0
1596
by: Sunil Pandita | last post by:
Hi all, I have created a windows service that is working well. Now i want to create the multiple instances of this service on the same box. How could it be possible?. One way that I thought was to create a contructor in the service class that will take the service name as the parameter and that may work but every time i have to...
0
2097
by: hunki | last post by:
I have "all" and "default" server running at one time and not simultaneously. We have a requirement to run them at the same time. How can this been done, in plane easy steps. I have read a number of forums here but nothing has been clear. Could somebody please help me and send me the exact instructions to run these servers at the same time. ...
0
1114
by: tamarindm | last post by:
Hi, I have a csharp application, running multiple instances of AxWebBrowser at the same time. Each web browser requires the same cookie, set using InternetSetCookie. If one AxWebBrowser control is navigating, another control is not able to recognise the cookie. If I waited until the first control is complete navigating, then start...
7
3191
patjones
by: patjones | last post by:
Good morning all - This is a pretty simple situation to describe. I have my database set up so that users type in a name and password when it first opens up. Provided the combination is correct, the log-in form closes and the main form opens. The username gets stored in a global variable called strUserID. My question is, say there are at...
0
1622
Pakmarshal
by: Pakmarshal | last post by:
I am running a 3rd party application that runs in javaw.exe, when I try to launch the second instance of the application. The application doesn’t respond. If anyone can guide, is this javaw.exe behavior (not running the second instance) or it’s just the applications behavior? This behavior becomes critical when 2 or more user try to use the...
0
71835
by: arulrajj | last post by:
What are the possible issues that might occur in postgres while running it as a multiple instances on different ports and having different data directories?
0
7636
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...
0
7948
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. ...
0
8000
tracyyun
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...
0
6329
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...
1
5523
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...
0
5247
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3671
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1238
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.