W32api Функции
Содержание
- w32api_deftype — Defines a type for use with other w32api_functions
- w32api_init_dtype — Creates an instance of the data type typename and fills it with the values passed
- w32api_invoke_function — Invokes function funcname with the arguments passed after the function name
- w32api_register_function — Registers function function_name from library with PHP
- w32api_set_call_method — Sets the calling method used
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения только для Windows
Коментарии
In order to use most (perhaps all?) of the win32 API while running with a web server you have to give the server service permission to interact with the desktop. This is especially noticeable with the given example, where the script will try to display message boxes on the server's display.
Keep in mind, however, that you should think hard about the consequences of letting a web server interact with your desktop, especially if you're not the only one using the web server.
hi
for phpgtk users, who might want to add some sound to their apps, here is the code, assuming ding.wav is in the script's directory
$api = new win32;
$api->registerfunction("long sndPlaySound (string a, int b) From winmm.dll");
$api->sndPlaySound("ding.wav", 0);
you can use the big win32.hlp file containing the win32 api reference to get some other multimedia functions
regards
Or google for "win32.hlp". Almost every API-function is listed in there.
The win32 support appears to be pretty flaky in php. This of course is to be expected with an experimental extension. That being said, if you are having trouble using the win32 functionality you may want to look into creating a PHP extension instead.
We were having some problems interfacing PHP with a 3rd party dll. As such we created an extension which wraps the interface with the aforementioned dll. The solution was surprisingly quick and painless.
Because we use Delphi primarily we found the following extremely useful and easy to use. http://users.chello.be/ws36637/php4delphi.html#download
more info here:
http://php.us.themoes.org/manual/en/zend.creating.php
Answer to the note posted by me at nullflux dot com (see below)
The Win32 API *does* work in other versions of PHP than between 4.2.0 and 4.2.3. However the documented functions are not available. You will have to use the "win32" class to access functions. For an example, read Philip Soeberg's post just below.
The only way I've been able to call Win32 API functions with PHP5 has been through COM and DynamicWrapper.
Get DynamicWrapper at:
http://ourworld.compuserve.com/homepages/Guenter_Born/
WSHBazaar/WSHDynaCall.htm
(remove new line)
Here's an example to play a beep sound with your computer speaker:
<?php
$com = new COM("DynamicWrapper");
$com->Register("KERNEL32.DLL", "Beep", "i=ll", "f=s", "r=l");
$com->Beep(5000, 100);
?>