Sumitro Chowdhury wrote:

> Thanks Lloyd. that was good info.
> I couldn't find related problem in the archives ... can you please send me 
> the URL to the discussion you mentioned ? I hope to learn more from that 
> thread.
> 
> Thanks for your time,

I sent a couple of emails with the fix I found - here's one of them
(don't ask me for an archive reference - you'll have to search yourself) :

>From - Fri May 20 18:22:12 2005
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00800000
Message-ID: <[EMAIL PROTECTED]>
Date: Fri, 20 May 2005 18:22:07 -0700
From: "$Bill Luebkert" <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.5) Gecko/20041217
X-Accept-Language: en, en-ca, en-au, en-gb, en-us, fr, de, es
MIME-Version: 1.0
To: cafs <[EMAIL PROTECTED]>
CC:  [email protected]
Subject: Re: Win32::API LPTSTR
References: <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to