I wrote:
> But how do I find and read the [COPYDATASTRUCT] structure pointed
> to by the integer $lParam ?
Well, I figured it out.
Here's a sub, not completely general, but handles the case
of a scalar message string.
Thanks for your indulgence.
(Maybe this will be useful for someone else searching the list archive.)
Cheers,
-Len
use Tie::Array::Pointer ;
sub read_COPYDATASTRUCT {
## input: $CopyData_p (eg from an lParam)
## output (scalar): $Msg (list): ($Msg, dwData_p)
my $CopyData_p = shift ;
my @CopyData_a ;
tie @CopyData_a, 'Tie::Array::Pointer',
{length => 3, type => 'L', address => $CopyData_p } ;
my ($dwData_p, $cbData_len, $lpData_p) = @CopyData_a ;
my @Msg_a ;
tie @Msg_a, 'Tie::Array::Pointer',
{length => $cbData_len, type => 'C', address => $lpData_p } ;
pop @Msg_a if @Msg_a[-1] eq "\0" ; ## pop off trailing null (more??)
my $Msg = pack "C$#Msg_a", @Msg_a ;
wantarray ? ($Msg, $dwData_p) : $Msg ;
}
On Jul 17, 2009, l...@weisberg.com wrote:
I am trying to use Win32::GUI from a Perl/Tk program
to receive and interpret a message sent from another window.
I have successfully set up a window to receive and a hook to
handle the message.
Using the example in Win32::GUI::Reference/Methods.pod, I have
sub msg_handler {
($object, $wParam, $lParam, $type, $msgcode) = @_;
print "Click handler called!\n";
}
The result looks reasonable in the debugger,
and $lParam is supposed to be a pointer to a WM_COPYDATA structure.
But how do I find and read the structure pointed to by the integer $lParam ?
I have a hunch that Win32::API::Struct could help, but I don't quite see how.
Thanks,
-Len
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________ 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/