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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on Shell

Status
Not open for further replies.

Learning123

Programmer
May 12, 2002
29
US
Hi Everyone,
I was wondering if it is possible to have my program to watch a program if it is closed. example, I've launched "Notepad" and would like a msgbox to pop up if notepad is closed by the user. Any ideas or comment are greatly welcome! Thanks a lot!

Andy
 
You can't know if a program closes but you can check to see if it is there.

So one way to go about this would be to use your program to open Notepad, then once it has done that enable a timer to check to make sure that it is still there.

The functions you want to use are Win API functions.

Public Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Declare Function WaitForSingleObject Lib "kernel32" Alias "WaitForSingleObject" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
wb Craig - long time no see Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Great! just what I was looking for!! Thanks a lot for the fantastic reponse everyone!! much aloha!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top