Perl Rob wrote:
> 
> I'm attempting to close a window using the FindWindow() and SendMessage()
> functions as documented in MSDN. I can't get it to work, so I was
> wondering
> if anyone might help me see what's wrong with my code:
> 
> use Win32::API;
> my $findWindow = Win32::API->new( 'user32', 'FindWindow', 'PP', 'P' );
> my $sendMessage = Win32::API->new( 'user32', 'SendMessage', 'PIIN', 'P' );
> my $windowToClose =
> $findWindow->Call("PGPtray_Hidden_Window","PGPtray_Hidden_Window");
> $sendMessage->Call($windowToClose,"WM_CLOSE",0,0);
> 
I see you've already answered your own question regarding the use of
Win32::GUI over Win32::API, but FTR, if you wanted to use Win32::API the
syntax would be

use Win32::API;

my $WM_CLOSE=16;  # you must assign this value manually
my $findWindow = Win32::API->new( 'user32', 'FindWindow', 'PP', 'N' );
my $sendMessage_lParam_as_number = Win32::API->new( 'user32', 'SendMessage',
'NNNN', 'N' );
my $sendMessage_lParam_as_stringpointer = Win32::API->new( 'user32',
'SendMessage', 'NNNP', 'N' );
my $windowToClose =
$findWindow->Call("PGPtray_Hidden_Window","PGPtray_Hidden_Window");
$sendMessage_lParam_as_number->Call($windowToClose,$WM_CLOSE,0,0);

-- 
View this message in context: 
http://www.nabble.com/FindWindow-and-SendMessage-tf4274735.html#a12258679
Sent from the perl-win32-gui-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to