Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-03

ActiveX in Lazarus and classic ASP

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

Hi,

I would like to know if is possible to made an ActiveX component using FPC/Lazarus. This component will be used integrated with a classic ASP web application.

I make these components using Delphi 7 but I would like to use Lazarus.

I installed the LazActiveX package, but I did'nt see an option to use something like "New>ActiveX..."

Thanks,
Marcos Douglas

Reply by email

Michael Van Canneyt
to Marcos Douglas
Marcos Douglas wrote 5 lines
Hi, I would like to know if is possible to made an ActiveX component using FPC/Lazarus. This component will be used integrated with a classic ASP web application.

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 ?

I make these components using Delphi 7 but I would like to use Lazarus. I installed the LazActiveX package, but I did'nt see an option to use something like "New>ActiveX..."

The activeX package registers a type library import item under tools, and adds a component TActiveXContainer to the component palette. This is to create visual controls that can be used using ActiveX.

Michael.

Reply by email

Marcos Douglas
to Michael Van Canneyt

Hi Michael,

Michael Van Canneyt 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

Reply by email

Michael Van Canneyt
to Marcos Douglas
Marcos Douglas wrote 51 lines
Hi Michael, On Fri, Mar 18, 2016 at 6:00 AM, Michael Van Canneyt 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.

Reply by email

Marcos Douglas
to Michael Van Canneyt
Michael Van Canneyt wrote
By studying ActiveX maybe ?

ActiveX is a Microsoft technology. Only study it does not mean that you can implement
using FPC ? I'm not saying does't possible ? or it will be simple to implement.

See the Delphi 7 implementation.
The units below are needed to create a simple ActiveX class:

ComObj, ActiveX, AspTlb, StdVcl;
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.

Code is about text, after all. :)

I do not need a Wizard at all, just wondering if there is some documentation to create an
ActiveX in the same way that Delphi 7 does.

Code like below is not about the ActiveX technology, but how Delphi implemented this
technology:

  IFooClass = interface;
  IFooClassDisp = dispinterface;
  CreateComObject(CLASS_FooClass) as IFooClass;
  CreateRemoteComObject(MachineName, CLASS_FooClass) as IFooClass;

Doesn't matter, for me, if the code will be created by hand or by a Wizard. But I would
like to know if this technology was fully implemented and documented. Do you know?

Regards,
Marcos Douglas

Reply by email