ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
Re: killing a process by window title; was: socket application
by other posts by this author
Jan 29 2003 8:17PM messages near this date
view in the new Beta List Site
Re: killing a process by window title; was: socket application | Re: killing a process by window title
>  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


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Thomas R Wyant_III

Dirk Bremer (NISC)

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved