Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding out if an application is running??? 3

Status
Not open for further replies.

VBDotNetProgrammer

Programmer
Jul 9, 2003
50
GB
Hi all need a bit of help here please,

I need to be able to check if outlook is running, is there an easy way to do this?

I also want to be able to launch outlook if it isnt running, im sure it is some sort of shell execute command?

Thanks
 
System.Diagnostics.Process.Start(filename)

will run the desired file/url/exe...

But I'm not sure how to detect whether it's running or not. In VB6 you had to search via API call for a window handle, and if you found one, the program was obviously running... but I don't know how .NET does it.

HTH
Ben
 
cool but dont i need to tell it where the file is? if that is the case that will be no good for me.

would

System.Diagnostics.Process.Start(OUTLOOK.exe)

do it?
 
Actually dont worry about the last question ive just tried it and it work fine thanks.

I still need to find out how to check if an app is running.
 
Code:
Dim p() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName("outlook")

If p.Length = 0 Then

	MessageBox.Show("Outlook not running!")

Else

	MessageBox.Show("Outlook running!")

End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top