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: 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

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