Re: Win32::API LPTSTR
by $Bill Luebkert other posts by this author
May 20 2005 6:28PM messages near this date
view in the new Beta List Site
Win32::API LPTSTR
|
Re: Win32::API LPTSTR
cafs wrote:
> Not sure if this is a resend, I needed to subscribe to this list:
> I am trying to use Win32::API to import by prototype only;
> of the functions I have tried the ones with type LPTSTR fail;
> I would like to just use the prototypes because if its packing functions
> Win32::API::Struct and Win32::API::Type - see the example in API.pm
>
> example
# around 158 in Win32::API::Type.pm if you comment these three lines out,
# it should work:
# if($is_pointer and $packing eq 'c') {
# $packing = "p";
# }
This now works:
use strict;
use warnings;
use Win32::API;
Win32::API-> Import('kernel32',
'DWORD GetTempPathA(DWORD ccBuffer, LPSTR lpszBuffer)') or
die "Import GetTempPathA: $^E";
my $lpszBuffer = pack 'Z*', ' ' x 80;
my $ret = GetTempPathA (80, $lpszBuffer);
printf "ret='%s'; lpszBuffer='%s'\n", $ret, substr $lpszBuffer, 0, $ret;
__END__
--
,-/- __ _ _ $Bill Luebkert Mailto:dbecoll@[...].net
(_/ / ) // // DBE Collectibles Mailto:dbe@[...].com
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Cafs
$Bill Luebkert
Lloyd Sartor
|