[Lazarus] ActiveX, TOLEControl

LacaK lacak at zoznam.sk
Tue Oct 18 15:52:57 CEST 2016


Hi *,

I need help with OCX component (not visual I guess), which I need use in 
Lazarus application (to control another application, which supplies this 
OCX control).
I have imported type library using importtl.exe (new unit was created 
successfully)

Then in program I have created instance:
   v := CreateOleObject('SCAPS.ScSamlightClientCtrl');
or
   intf := CreateComObject(CLASS_ScSamlightClientCtrl) as 
_DSamlight_client_ctrl_ocx;

But all next attampts using any interface method fail with EOleSysError 
"Catastrophic failure" (ErrorCode=-2147418113)

In Delphi it works, but only when I use TOLEControl descendant created 
by Delphi's import of ActiveX (into _TLB unit)
In Delphi I have :

TScSamlightClientCtrl = class(TOleControl)
...

but in Lazarus I have no equivalent? (When I Delphi I do same as in 
Lazarus I get same error also in Delphi)

I do not know exacly what to ask here ?
What is purpose of TOleControl and what TOleControl did more than I can 
do in Lazarus ?
Can I somehow workaround it in Lazarus ?

In short what I have imported from type lib in Lazarus is interface:
  _DSamlight_client_ctrl_ocx = dispinterface
    ['{05D31AA6-1306-4DA0-9AE2-A8771FF6FA94}']
    function ScIsRunning:Integer;dispid 1;
   ... etc.
end;

and CoClass:
   Class Function CoScSamlightClientCtrl.Create: _DSamlight_client_ctrl_ocx;
   begin
     Result := CreateComObject(CLASS_ScSamlightClientCtrl) as 
_DSamlight_client_ctrl_ocx;
   end;

I can create instance calling CoScSamlightClientCtrl.Create, but as I 
wrote I can not use any method ...

Can somebody give any help ?

Thanks

-Laco.




More information about the Lazarus mailing list