I know that I can consume COM components but is there a way to directly call into the Win32 API's (user32.dll, advapi32.dll etc) from PHP or do I need to wrap in a PHP extension or COM object?
Asked
Active
Viewed 8,013 times
2 Answers
5
See the first comment here:
The only way I've been able to call Win32 API functions with PHP5 has been through COM and DynamicWrapper.
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);
?>
You can get an updated DynamicWrapper here. You have to register it with regsvr32.

Community
- 1
- 1

Janus Troelsen
- 20,267
- 14
- 135
- 196
1
The win32api support for php is very flaky. Have a look at this

Dave
- 197
- 1
- 2
- 7
-
I think win32api got yanked. Phalanger would be nice but sadly not an option. – Kev Sep 11 '09 at 16:16
-
Hmm...I feel a COM wrapper is in the pipeline. – Kev Sep 11 '09 at 16:21