How to write a DLL that can play with w32api?
| From: | DvDmanDT | Date: | Sat, 14 Jun 2003 18:30:24 +0000 |
| Subject: | How to write a DLL that can play with w32api? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-151500@lists.php.net to get a copy of this message | ||
Hello, I was wondering how to write a DLL that I can use from
php_w32api.dll? I want to get the memory usage using this code:
###########################################################
dl("php_w32api.dll");
$api = new win32;
$api->definetype("MEMORYSTATUS {
long dwLength;
long dwMemoryLoad;
long dwTotalPhys;
long dwAvailPhys;
long dwTotalPageFile;
long dwAvailPageFile;
long dwTotalVirtual;
long dwAvailVirtual;
}");
$api->registerfunction("long GlobalMemoryStatus (MEMORYSTATUS &a) From
kernel32.dll");
$a=$api->InitType("MEMORYSTATUS");
$api->GlobalMemoryStatus($a);
print_r( $a); // Prints like [0] => Resource id #6
class MEMORYSTATUS
{
var $dwLength =0;
var $dwMemoryLoad=0;
var $dwTotalPhys=0;
var $dwAvailPhys=0;
var $dwTotalPageFile=0;
var $dwAvailPageFile=0;
var $dwTotalVirtual=0;
var $dwAvailVirtual=0;
}
$b=new MEMORYSTATUS;
$api->GlobalMemoryStatus($b);
print_r( $b);// Prints all of the names, but all values are 0
###########################################################
So I need another function to which I can pass $a and then get an int back
or something that PHP can hande... I got visual studio 6... I got cygwin as
well... I use Windows ME... Any help is appreciated...
Thanks in advance // DvDmanDT