Thursday, February 10, 2011

How to call COM function from PHP with OLE_COLOR as an argument?

I am trying to call a COM object from PHP using the COM interop extension. One function requires an OLE_COLOR as an argument? Is there any way to pass this kind of value from PHP?

I have tried passing a simple integer value with no success.

$this->oBuilder->Font->Color = 255;
  • When I've called COM functions from PHP, I just passed them in the call. So my old code has:

    $myComObject = new COM("MY_COM_OBJECT");
    $myComObject->Myfunction( myVar1, myVar2, 'my string var');
    
  • PHP can define the constants the COM exposes automatic.

    set_ini('com.autoregister-typelib', true);

    or by hand

    com_load_typelib($typelib_name);

    But if the OLE_COLOR is a object instead of an integer, string or other primitive
    using constants (or integers) won't work.

    $Color = new COM('ColorClass');
    $Color->set_color_function($red, $green, $blue);
    

    Or something similar will.

    From Bob Fanger

0 comments:

Post a Comment