app running

  • Thread starter Thread starter Rado
  • Start date Start date
Hi Rado,

I was giving an answer than I thought you can mean a lot of other things,
can you explain it a little bit more by instance , from inside the program
or from outside the program?

Cor
 
Hi Chris,

You know this one?

Private mut As New Threading.Mutex(True, "myProg", mutCreated)
Private Sub Form1_Load(ByVal sender As Object,_
ByVal e As System.EventArgs) Handles MyBase.Load
If Not mutCreated Then Me.Close()
End Sub

Cor
 
Hi Cor

I know that one. I like the example from codeproject as it also activates the previous instance. Which is what our customers like

Chris.
 
Hi Cor,

I know that one. I like the example from codeproject as it also activates the previous instance. Which is what our customers like.

Chris.

And not very reliable.... Their are two major problems with this code.
First, the use of the process name. Process names are not guarenteed to
be unique. So, you may end up keying on a another process that happens
to name it's executable the same as yours. Not likely maybe, but still
a possiblity.

The second problem is the use of SetForegroundWindow. As of Windows 98/2000,
that may or may not work as expected. To reliably use
SetForegroundWindow in this manner, you need to use AttachThreadInput to
make sure that your application is attached to the windows input queue.
 
Hi Tom,

Ok Ok,

See on this page, this guy has made a nice part from it.
My sample was to show that there was also a super simple way.
And I am always for "keep it simple".

It is in the German language, but that should go.

<URL:http://dotnet.mvps.org/dotnet/code/application/>
-> "Nur eine Instanz der Anwendung zulassen"

:-))))

Cor
 
Hi Tom,

Ok Ok,

See on this page, this guy has made a nice part from it.
My sample was to show that there was also a super simple way.
And I am always for "keep it simple".

It is in the German language, but that should go.

<URL:http://dotnet.mvps.org/dotnet/code/application/>
-> "Nur eine Instanz der Anwendung zulassen"

:-))))

Cor

Cor,

I was refering to the Codeproject code. Here is an example from MSDN
that is a more complete solution - and stays inside the managed
evironment. This the link to the first part of the article (the code is
unfortunately in C#):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/reaworapps1.asp

But, I agree that simple is the best.
 
Tom

Thanks for the link. I have added it to my favorites and will look at changing my code when I get time

Chris

----- Tom Shelton wrote: ----

Hi Tom
My sample was to show that there was also a super simple way
And I am always for "keep it simple"

Cor

I was refering to the Codeproject code. Here is an example from MSD
that is a more complete solution - and stays inside the manage
evironment. This the link to the first part of the article (the code i
unfortunately in C#)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/reaworapps1.as

But, I agree that simple is the best
 
Back
Top