473,387 Members | 1,606 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,387 software developers and data experts.

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 20841
* "Clark Stevens" <cy*********@hotmail.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*********@hotmail.com> wrote in message
news:yE*******************@twister.nyroc.rr.com...
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.com> wrote in message
news:%2****************@TK2MSFTNGP09.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*********@hotmail.com> wrote in message
news:cw*******************@twister.nyroc.rr.com...
"Samuel L Matzen" <sm*****@slm.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.com> wrote in message
news:O$**************@TK2MSFTNGP09.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*********@hotmail.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*********@hotmail.com> wrote in message
news:4U*******************@twister.nyroc.rr.com...

"Samuel L Matzen" <sm*****@slm.com> wrote in message
news:O$**************@TK2MSFTNGP09.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**************@tk2msftngp13.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*********@hotmail.com> wrote in message
news:BH*******************@twister.nyroc.rr.com...
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ui**************@tk2msftngp13.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
"Samuel L Matzen" <sm*****@slm.com> wrote in message
news:eU**************@tk2msftngp13.phx.gbl...
Clark,

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

-Sam Matzen


I use keyboard shortcuts quite a bit, and was always annoyed by my Internet
Explorer always opening a new window instead of switching to the existing
one when I used the shortcut.

Using XP, I can assign a keyboard shortcut to IE in my start menu, or to a
shortcut on a desktop, and it always opens a new instance. Doing the same
with a VB.NET program always switches to the open application instance.

Seems that MS is able to do it for themselves, at least. :-)

Best Regards,

Andy
Nov 20 '05 #11

"Andy Becker" <x@x.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Using XP, I can assign a keyboard shortcut to IE in my start menu, or to a
shortcut on a desktop, and it always opens a new instance. Doing the same
with a VB.NET program always switches to the open application instance.


More info... The same experiment with Firefox instead of IE has it acting
the same as a VB.NET application, i.e. only one instance is opened.
Sumpin's up with IE, methinks.

Best Regards,

Andy
Nov 20 '05 #12

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

Similar topics

1
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...
4
by: PalB | last post by:
How to stop running multiple instances of my App in C#? Thanx
1
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...
0
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...
0
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...
0
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...
7
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,...
0
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...
0
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.