Using GWindows to Give ActiveX Controls to Claw


It is possible to use ActiveX controls with Claw. The easiest way to do so is to use GWindows to add the control to the Claw window. This example places the Internet Explorer control in to a Claw window.
with Interfaces.C;

with Claw.Frame_Window;
use Claw.Frame_Window;

with GWindows.Base;
with GWindows.ActiveX;
with GWindows.Types;
with GWindows.Application;
with GNATCOM.Dispinterface;
with GNATCOM.VARIANT;
with GNATCOM.Initialize;

procedure clawactivex is
   pragma Linker_Options ("-mwindows");

   function GetForegroundWindow return GWindows.Types.Handle;
   pragma Import (StdCall, GetForegroundWindow, "GetForegroundWindow");


   Display     : Frame_Window_Type;
   Main_Win    : GWindows.Base.Base_Window_Type;
   A_Control   : GWindows.ActiveX.ActiveX_Type;
   IE_Control  : GNATCOM.Dispinterface.Dispinterface_Type;
begin
   Create (Window => Display,
           Window_Name => "The Hello Program");
   Show (Window => Display, How => Claw.Codes.Show_Startup);

   GNATCOM.Initialize.Initialize_COM;

   GWindows.Base.Attach (Main_Win, GetForegroundWindow);
   GWindows.ActiveX.Create (A_Control, Main_Win, "Shell.Explorer", 0, 0,
                            GWindows.Base.Client_Area_Width (Main_Win),
                            GWindows.Base.Client_Area_Height (Main_Win));

   GNATCOM.Dispinterface.Query (IE_Control,
                                GWindows.ActiveX.Interface (A_Control));
   GNATCOM.Dispinterface.Invoke
     (IE_Control, "navigate",
      (1 => GNATCOM.VARIANT.To_VARIANT ("http://www.adapower.com/adapower1")));

   GWindows.Application.Message_Loop;

end clawactivex;


Contributed by: David Botton
Contributed on: April 28, 2002
License: Public Domain

Back