[Israel.pm] Fwd: GPF when running GetModuleFileName()
Nahum Cohen
nahum.cohen at gmail.com
Wed Sep 21 04:26:36 PDT 2005
Hi list,
I already got an answer, thanks to Bill.
Apparently I was using the latest Win32::API::Prototype version from
CPAN, but Roth Consulting web site [1] had a newer version which
solved the problem.
Using Win32::API::Prototype version 20021217 - all work fine.
Thanks,
Nahum
[1] http://www.roth.net/perl/prototype/
---------- Forwarded message ----------
From: Nahum Cohen <nahum.cohen at gmail.com>
Date: Sep 21, 2005 8:10 AM
Subject: GPF when running GetModuleFileName()
To: Perl in Israel <perl at perl.org.il>
Hi,
I'm using Win32::API::Prototype to run GetModuleFileName().
Does anyone knows why I get a GPF when running this code:
ApiLink( 'kernel32.dll', 'DWORD GetModuleFileName (HMODULE hModule,
LPTSTR lpFilename, DWORD nSize)' ) || die;
$nSize = 256;
$lpFilename = NewString ($nSize);
GetModuleFileName (NULL, $lpFilename, $nSize);
print "The module file name is: \"$lpFilename\"\n";
while this example (from Win32::API::Prototype documentation) works fine:
ApiLink( 'kernel32.dll', 'DWORD GetCurrentDirectory (DWORD
nBufferLength, LPTSTR lpBuffer)' ) || die;
$nBufferLength = 256;
$lpBuffer = NewString ($nBufferLength);
GetCurrentDirectory ($nBufferLength, $lpBuffer );
print "The current directory is: \"$lpBuffer\"\n";
Thanks,
Nahum
More information about the Perl
mailing list