| Store | Cart

Re: killing a process by window title; was: socket application

From: <shu...@wencor.com>
Wed, 29 Jan 2003 13:17:04 -0700



> Now, getting the window title I don't know about. I was about to suggest> Win32::Console::Title, but that, I believe, is only the command window
(if
> any) that is running the current script.>> Anyone?>

I would try using Win32::API with autoitdll.dll (hiddensoft.com).  I tested
the snippet below and it does the trick. (There is a more forcefull call of
WinKill if the app is not responding).


use Win32::API;

# void WINAPI AUTOIT_SetTitleMatchMode(
#     int nMode
# );
my $autoit_match_mode = new Win32::API("AutoItDLL",
"AUTOIT_SetTitleMatchMode", [I], V);

# void WINAPI AUTOIT_WinClose(
#    char *szTitle,
#    char *szText
# );
my $autoit_close = new Win32::API("AutoItDLL", "AUTOIT_WinClose", [P,P],
V);

$autoit_match_mode->Call(1);
$autoit_close->Call("test.txt - Notepad", ""); # leaves other instances of
Notepad alone



Steve

Recent Messages in this Thread
Thomas R Wyant_III Jan 29, 2003 02:52 am
Dirk Bremer \(NISC\) Jan 29, 2003 02:56 pm
shu...@wencor.com Jan 29, 2003 08:17 pm
Messages in this thread