[Lazarus] ActiveX in Lazarus and classic ASP
Marcos Douglas
md at delfire.net
Fri Mar 18 14:43:44 CET 2016
Hi Michael,
On Fri, Mar 18, 2016 at 6:00 AM, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
> As far as I know, the only thing you need to do is create a class that
> implements IDispatch. You hardly need a wizard for that, I think ?
Well, using Delphi 7 I click in 'New'>'ActiveX'>'Active Server Object'.
After type the "CoClass Name" -- TFooClass for example -- and choose
some parameters, the IDE creates:
1. An unit contents a pre-implementation of my class:
uses
ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl;
type
TFooClass = class(TASPObject, IFooClass)
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
end;
2. A file like "project_TLB.pas" that have, between others things:
IFooClass = interface;
IFooClassDisp = dispinterface;
...
CoFooClass = class
class function Create: IFooClass;
class function CreateRemote(const MachineName: string): IFooClass;
end;
...
class function CoFooClass.Create: IFooClass;
begin
Result := CreateComObject(CLASS_FooClass) as IFooClass;
end;
class function CoFooClass.CreateRemote(const MachineName: string): IFooClass;
begin
Result := CreateRemoteComObject(MachineName, CLASS_FooClass) as IFooClass;
end;
3. An "wizard" to insert new methods to simplify, I think, and a
"Text" is created on demand like that:
FooClass = coclass(IFooClass [default] )
[ uuid '{E984E6AF-C43A-4B34-BF96-E03B43AC6A3E}',
version 1.0,
helpstring 'FooClass Object' ];
But I don't know if is relevant... anyway.
So, how an new FPC programer should know these things to make a ActiveX?
I could be wrong, but I don't think just implement IDispatch is enough, do you?
Best regards,
Marcos Douglas
More information about the Lazarus
mailing list