Newbie Dealing with .exe files

G

Guest

Hi: I am writing a program to make changes to the texture files of a game.
It is important that the game not be running while the changes are made.

Is there a way in VB.net to determine if a program "XYZ.exe" is currently
running?

Also, is there a way from within the code to cause a program, "ABC.exe" to
start running?

thanx.....joisey
 
C

Cor Ligthert

Joisey,

I give always nice links where it is proper done and than people give
solutions wich has the same effect as this one however not so simple, so now
I show this very simple one again.
\\\
Private mut As New Threading.Mutex(True, "myProgram", mutCreated)
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not mutCreated Then Me.Close()
'etc
End Sub
///
Problem with this one and a lot of others samples given in this newsgroup,
is that when there is another program with exactly the same name as your
program, that will not run as well.

However this one is really very simple and I hope this helps?

Cor
 
K

Ken Tucker [MVP]

Hi,

To see if the game is running take a look at
process.getprocessbyname

http://msdn.microsoft.com/library/d...osticsprocessclassgetprocessesbynametopic.asp

Ken
------------------
Hi: I am writing a program to make changes to the texture files of a game.
It is important that the game not be running while the changes are made.

Is there a way in VB.net to determine if a program "XYZ.exe" is currently
running?

Also, is there a way from within the code to cause a program, "ABC.exe" to
start running?

thanx.....joisey
 
H

Herfried K. Wagner [MVP]

Cor Ligthert said:
I give always nice links where it is proper done and than people give
solutions wich has the same effect as this one however not so simple, so
now I show this very simple one again.
\\\
Private mut As New Threading.Mutex(True, "myProgram", mutCreated)
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not mutCreated Then Me.Close()
'etc
End Sub
///

Mhm... In this particular case I think the OP wants to check if a certain
(other) application is running. The mutex approach will only work if you
have control over the app's implementation.
 
C

Cor Ligthert

Herfried,

After that I saw the message from Ken, I think that it is both and Ken
corrected that already.

Cor
 
G

Guest

Thanx
this looks like what I need.
I will bookmark the msdn library for future use
......joisey
 

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

Similar Threads

EXE update 1
Can Setup.exe automatically start my .exe file? 2
File compare 5
Deployment options---no wizrard 1
Newbie Question Where to put files? 5
More trouble with deployment 1
Newbie VB Question 5
batch file 1

Top