The Win32::API::Struct v0.41 module documentation states the following:
Also note that typedef automatically defines an 'LPNAME' type, which holds a pointer to your structure.
Using the example in that documentation, I have created a POINT structure. This should mean that I have also automatically created an LPPOINT structure.
If this is the case, why does the following not work:
#!c:\perl\bin\perl -w use strict; use Data::Dumper; use Win32::API; Win32::API::Struct->typedef( 'POINT', 'LONG', 'x', 'LONG', 'y' ); my $point = Win32::API::Struct->new( 'LPPOINT' ) or die $!; print Dumper( $point );
with the error message being:
Unknown Win32::API::Struct 'LPPOINT' at C:\point.pl line 9 Died at C:\point.pl line 9, line 164.
Is the documentation wrong or am I not reading it correctly?
Thanks,
fx, Infinity is Colourless
LPPOINT is not a structure, it is a type.
POINT is a structure, and LPPOINT is, long pointer to a POINT structure.
You create a POINT structure, fill in the values, and then pass it to an api call that takes an LPPOINT as an argument. Under the covers, Win32::API obtains the address of the memory Perl allocates to hold the POINT structure and passes that to the api.
I've had a look at the C function I am trying to call and althought it wants a pointer to struct, the variable name for this pointer to struct does not being LP - it's just called WORKITEMINFO.
In my mind, therefore, the automatic pointer creation of Win32::API::Struct isn't going to help me.
Does anyone have any suggestions as to how I should progress this - it's almost getting to the point where I might as well just write this in C! :)
fx, Infinity is Colourless
perlmonks.org content © perlmonks.org and BrowserUk, fx
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03