Re: Calling API on Windows?
| From: | Jochem Maas | Date: | Fri, 24 Feb 2006 10:15:48 +0000 |
| Subject: | Re: Calling API on Windows? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231007@lists.php.net to get a copy of this message | ||
HoWang Wang wrote:
> 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.
could you please move the roof of your house so I
can see your computer monitor? (what's the error?)
did you search for the error on google or yahoo or
<insert-favorite-search-engine>?
> 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
>>>
>
>