[Lazarus] ActiveX in Lazarus and classic ASP
Michael Van Canneyt
michael at freepascal.org
Fri Mar 18 15:57:05 CET 2016
On Fri, 18 Mar 2016, Marcos Douglas wrote:
> 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?
By studying ActiveX maybe ?
> I could be wrong, but I don't think just implement IDispatch is enough, do you?
Maybe I was a bit short on details in my reply :-)
Yes, you can of course write a wizard that does all this.
It's just generating text, after all.
Michael.
More information about the Lazarus
mailing list