Re: Calling API on Windows?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

How can I use it?
For example:
[lib='user32.dll'] int MessageBoxA(int handle, char *text, char
*caption, int type);
How can I write this sentence?
What is the format?
And I want to use GetComputerNameA, what can I do?

<?php
$win32_idl = "[lib='user32.dll'] int MessageBoxA(int handle, char *text,
char *caption, int type);
[lib='kernel32.dll'] int GetComputerNameA (char *lpBuffer, DWORD nSize);";

$ffi = new ffi($win32_idl);
$compname = '';
$r = $ffi->GetComputerNameA($compname,255);
echo $r; //Debug
echo $ffi->MessageBoxA(0, "The Computer Name is " . $compname, "Test", 0);
?>

doesn't work, it give me an error.
Please help, thx!


Jochem Maas wrote:
> Hi Ho, (7 dwarfs anyone? ;-)
> 
> click this link to download php4.4.2 (not the installer version)
> it contains the DLL your looking for:
> 
> http://hk.php.net/get/php-4.4.2-Win32.zip/from/a/mirror
> 
> in the event that your using php5 then w32api is no longer
> available - it has been replaced with fcc:
> 
> http://pecl.php.net/package/ffi
> 
> you can download a binary ddl (built automatically from cvs) here:
> http://pecl4win.php.net/ext.php/php_ffi.dll
> 
> 
> HoWang Wang wrote:
> 
>>Dear all,
>>
>>I have a question on w32api ( http://hk.php.net/manual/en/ref.w32api.php
>>). I'm developing a command line program with PHP on windows, and I want
>>to call some API. But I cannot found the dll required for the w32api
>>extension. I'm using PHP/5.0.5, does anyone have an idea? Or there is
>>another extension can call Windows API?
>>
>>Thanks
>>Ho Wang
>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux