I am trying to replace an old and unsupported Win32 library. In doing so,
I am attempting to get the following piece of code to work prior to adding
it to my own library:
-------- Cut Here ---------
#!/usr/bin/perl -w
use strict;
use Win32;
use Win32::API;
Win32::API::Struct->typedef('MEMORYSTATUSEX', qw(
DWORD dwLength;
DWORD dwMemoryLoad;
DWORD64 ullTotalPhys;
DWORD64 ullAvailPhys;
DWORD64 ullTotalPageFile;
DWORD64 ullAvailPageFile;
DWORD64 ullTotalVirtual;
DWORD64 ullAvailVirtual;
DWORD64 ullAvailExtendedVirtual;
));
Win32::API->Import('kernel32',
'BOOL GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)');
# my $memoryInfo = Win32::API::Struct->new('MEMORYSTATUSEX');
tie my %memoryInfo, 'Win32::API::Struct', 'MEMORYSTATUSEX';
my $rc = GlobalMemoryStatusEx(\%memoryInfo);
printf ("TotalPhys = %d\n", $memoryInfo{ullTotalPhys});
print ("Finished\n");
-------- Cut Here ---------
When I try to run this program on a x86 version of ActivePerl 5.8.9 Build
828, I get the error:
Invalid type 'Q' in pack at C:/Perl/lib/Win32/API/Struct.pm line 230.
when it gets to line 25 (actual call of the Win32 API).
Since I need to run this bit of code on both the 32-bit and 64-bit
Windows, how can I get this to work?
API Info: http://msdn.microsoft.com/en-us/library/aa366589
Regards,
Michael Cohen
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs