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

_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to