<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"><TITLE>Start and stop process</TITLE></HEAD><BODY><P><FONT SIZE=2 FACE="Arial">Hello everybody:</FONT></P><P><FONT SIZE=2 FACE="Arial">I need to start a program from inside VEE, so I use the Execute Program (PC) object. My problem begins when I need to stop this program. Some of you know any way to do this? It could be possible to find the process ID of the external program and send it a "kill" event?</FONT></P><P><FONT SIZE=2 FACE="Arial">Any information would be appreciated.</FONT></P><P><FONT SIZE=2 FACE="Arial">Thanks</FONT></P><P><FONT COLOR="#000080" FACE="Comic Sans MS">Angel Cano</FONT><BR><FONT COLOR="#000080" FACE="Comic Sans MS">Test Department</FONT><BR><FONT COLOR="#000080" FACE="Comic Sans MS">Tfno: +34 91 205 4595</FONT><BR><FONT COLOR="#000080" FACE="Comic Sans MS">Fax: +34 91 205 4602</FONT><BR><FONT COLOR="#000080" FACE="Comic Sans MS">email: angel.cano@itp.es</FONT></P>---<BR>You are currently subscribed to vrf as: rsb@soco.agilent.com<BR>To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list, email "vrf@agilent.com". <BR>If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".</BODY></HTML>
> program and send it a "kill" event?
You have the right idea. The proper way to exit an application is to find
it's main window handle and send it a WM_CLOSE message. You can also use
TerminateProcess, but that is an emergency measure only. It's basically like
using the "End Process" button of the Task Manager.
Finding a main window handle is not difficult. There have been several
different solutions posted through the years. Search the archive for
BodyContains = FindWindow and you'll get a lot of hits.
If the application is stubborn and doesn't want to close, search the archive
for AttachmentName = KillExcel. Excel is notorious for not behaving properly
:). KillExcel is easy to modify for any process.
-SHAWN-
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".