views:

301

answers:

1

Hi !

I'm using xampp.

I search and it looks like for php 4.x, there was an extension called php_w32api.dll which seems to have vanished for php 5.x. Nevertheless, it's still in the documentation on php.net but marked as experimental.

Some suggested to use win32std in pecl instead, but that just wraps some function of the win32 api, but doesn't allow me do call my own dll functions. :/

There is ffi, but the link on the pecl site is dead and it seems like development has stopped in 2004.

Any idea how to do this without writing my own php extension?

Best regards Marc

+1  A: 

COM functions are only available for the Windows version of PHP. .Net support requires PHP 5 and the .Net runtime. No installation needed to use these functions; they are part of the PHP core.

First create your ActiveX dll (Visual Basic): Name your project as "foo" and class as "bar".

'---start VB code---
Public Function hello() As String
   hello = "Hello World!"
End Function
'---end VB code---

Then make the dll and register it with regsvr32.exe Now create your PHP script:

 <?php
    $obj = new COM("foo.bar");
    $output=$obj->hello(); // Call the "hello()" method
    // once we created the COM object this can be used like any other php classes.
    echo $output; // Displays Hello World! (so this comes from the dll!)
    ?>
streetparade
Hmm. And what if I already have a dll that exports simple functions? Is this applicable somehow?
marc40000
hmm.. if you know what functions this dll provides then you just have to catch the logic and put it in to your php app ;-)
streetparade
I don't. I haven't written the dll.
marc40000