Custom Buttons calling Delphi DLL

Does anyone have any experience of creating a DLL written in Delphi to be called from a custom button?

I have written a simple DLL containing a COM object that I can call successfully from a Delphi client, but cannot get it to run from a Custom button.

When debugging, it calls the TTypedComObjectFactory.Create line (so it finds the DLL ok and it is registered) but I get the error: "ActiveX component can't create object."

The code looks like this:

unit RMSTestDLL;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses Windows, ActiveX, Classes, ComObj, RMSTestDLL_TLB, StdVcl, QSRules_TLB;

type TRMSTestDLL = class(TTypedComObject, IRMSTestDLL) protected {Declare IRMSTestDLL methods here} function Process(var RMSSession: SessionClass):boolean; end;

implementation

uses ComServ, Dialogs;

function TRMSTestDLL.Process():boolean; begin ShowMessage('Ok'); Process := True; end;

initialization TTypedComObjectFactory.Create(ComServer, TRMSTestDLL, Class_RMSTestDLL, ciMultiInstance, tmApartment); end.

Any suggestions very welcome.

Regards,

John

Reply to
John Dinning
Loading thread data ...

I have a question...

The interface IRMSTest inherit from IUnknown or IDispatch ?

I not know internally SO, but I think that it use IDispatch to invoke unknown object for add-on

cod

Reply to
cod

Ah yes, well spotted, that was a cut and paste error when posting. I tried with and without the parameter but the function should have the var RMSSession: SessionClass parameter the same as the declaration. It still doesn't work.

your code is correct

formatting link

but the declaration of Process function is different from the implementation ...

cod

Reply to
John Dinning

Thanks cod. I am not sure, but it gives me something to investigate. I will report back.

John.

Reply to
John Dinning

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.