|
-
November 11th, 1999, 02:24 PM
#1
How to check for runnig application if not running restart it
OK I am in a dilemma. I need to make or get a program that sees if a certain application is running on a system. If it is than nothing happens. If It is not then I need it to be started. It needs to run under NT. I would also like to run the program(the newly created one) in the systray "if that is possible with Visual Basic"... The program would need to be on a timer and check every so often... Any help would be most appreciated.
-
November 12th, 1999, 03:07 AM
#2
Re: How to check for runnig application if not running restart it
if the application you want to start has a window, you could use the FindWindow API to check if the app is running.
if it's a COM Server (like Excel), you could use GetObject to check if it is running.
To place your app into the system tray check out Aaron Young's post from today.
-
November 12th, 1999, 09:20 AM
#3
Re: How to check for runnig application if not running restart it
Thanks.. Now where can I find out more information about those Windows API calls?
Do you know of any good VB books that would be useful?
-
November 12th, 1999, 10:30 AM
#4
Re: How to check for runnig application if not running restart it
to get the Declare statements for these APIs use the Api Viewer add-in,
to get more descriptions check MSDN - platform SDK.
Dan Appleman has written several books for VB programmers that want to make use of API functions.
FindWindow is fairly easy to use:
private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (byval lpClassName as string, byval lpWindowName as string) as Long
private Sub Command1_Click()
If FindWindow(vbNullString, "Unbenannt - Editor") then
MsgBox "notepad running"
End If
End Sub
this code checks for a German version of Notepad (with no file opened).
The class name argument is more reliable, but you need to get that via a spy utility like Spy++ that comes with Visual Studio Tools.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|