running one application at a time


° ^F®êâK^ °

hi there,

I just want to explain my problem. There is an application which is coded by
me running. It is an application having user controls windows forms
and something like visual components. Also i can send some command line
options from the command line

for example >> C:\xxx.exe -a

i can run this application without command line options also, however every
call of the xxx.exe create a seperate windows form and display it on the
desktop. I want to run this application many sequantial times with command
line options without creating many windows form but new command line options

I mean

xxx.exe -a "Something"

while previous one is running

xxx.exe -a "Something Else"

will do something else...

xxx.exe has list box... first run is add the "Something" text into the
listbox and while it is running, the second run is add the "Something Else"
text into the same listbox under the "Something" text.

how can i success this?

° ^F®êâK^ °

Thanks for those links,
they don't solve my problem completely but give me some different ideas...

Ken Tucker [MVP]


Use a mutex. Start the program from sub main

Public Sub main()
Dim owned As Boolean
Dim mut As New System.Threading.Mutex(True, "xvcjsdf67AS124#$3",

If owned Then
Application.Run(New Form1)
MessageBox.Show("A previous instance is already running")
End If
End Sub


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question