Board index » cppbuilder » Need HowTo on Building ActiveX

Need HowTo on Building ActiveX

I am looking for information on how to build ActiveX components with
C++Builder.  Specifically I am looking for a way to create an
invisible component that has some exposed functions that can be called
(with parameters) from a web page.  Any help would be greatly
appreciated.  Thanks!

Stephen Anderson

 

Re:Need HowTo on Building ActiveX


Hello,

I can answer this from the delphi point of view, but im sure
that you can use this information also in C++Builder

You must derive the control from TCustomControl, because
ActiveX Controls must have a Windowhandle.

If you want to make a ActiveX control invisible at runtime, add the
OLEMISC_INVISIBLEATRUNTIME Flag in the initialisation
part of its implementation unit:

initialization
  TActiveXControlFactory->Create(
    ComServer,
    TXX,
    TXXControl,
    Class_XX,
    1,
    '',
    OLEMISC_INVISIBLEATRUNTIME,  //<------HERE !!!!
    tmApartment);

To display a designtime icon, simple draw a bitmap
in the Paint event handler of the VCL Component:

procedure TXXControl.Paint;
begin
  Width := BitMap.Width; Height := BitMap.Height;
  Canvas.Draw(0, 0, BitMap);
end;

Also read the very good DAX FAQ's from Conrad Herrman,
of course for delphi, but the information is very good.

http://pw2.netcom.com/~cherrman/dl030.htm#whatis

if your control needs to know if its in designmode or runtime
try the following:

procedrue MyAxControl.EventSinkChanged(...
begin
  FEvents := EventSink as IMyControlEvents;

FDelphiControl.Visible := FALSE;
  if GetClientSite(clientSite) = S_OK then
    if (clientSite <> nil) and (clientSite as IAmbientDispatch).UserMode
then
      FDelphiControl.Visible := TRUE;
end;

Hope you can read the Delphi code examples......

Bye

Stefan, Germany

Stephen Anderson schrieb in Nachricht
<36b1d59d.84065...@forums.inprise.com>...

Quote
>I am looking for information on how to build ActiveX components with
>C++Builder.  Specifically I am looking for a way to create an
>invisible component that has some exposed functions that can be called
>(with parameters) from a web page.  Any help would be greatly
>appreciated.  Thanks!

>Stephen Anderson

Other Threads