unit Client_Unit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ActiveX, AxCtrls, Client_TLB, ScktComp, Gauges, StdCtrls, Label3D,
  ExtCtrls, JpgImg;

type
  TWinDn = class(TActiveForm, IMain)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    FEvents: IMainEvents;
    procedure ActivateEvent(Sender: TObject);
    procedure ClickEvent(Sender: TObject);
    procedure CreateEvent(Sender: TObject);
    procedure DblClickEvent(Sender: TObject);
    procedure DeactivateEvent(Sender: TObject);
    procedure DestroyEvent(Sender: TObject);
    procedure KeyPressEvent(Sender: TObject; var Key: Char);
    procedure PaintEvent(Sender: TObject);
  protected
    { Protected declarations }
    procedure EventSinkChanged(const EventSink: IUnknown); override;
    procedure Initialize; override;
    function Get_Active: WordBool; safecall;
    function Get_AutoScroll: WordBool; safecall;
    function Get_AxBorderStyle: TxActiveFormBorderStyle; safecall;
    function Get_Caption: WideString; safecall;
    function Get_Color: Integer; safecall;
    function Get_Cursor: Smallint; safecall;
    function Get_DropTarget: WordBool; safecall;
    function Get_Enabled: WordBool; safecall;
    function Get_HelpFile: WideString; safecall;
    function Get_KeyPreview: WordBool; safecall;
    function Get_PixelsPerInch: Integer; safecall;
    function Get_PrintScale: TxPrintScale; safecall;
    function Get_Scaled: WordBool; safecall;
    function Get_Visible: WordBool; safecall;
    function Get_WindowState: TxWindowState; safecall;
    procedure Set_AutoScroll(Value: WordBool); safecall;
    procedure Set_AxBorderStyle(Value: TxActiveFormBorderStyle); safecall;
    procedure Set_Caption(const Value: WideString); safecall;
    procedure Set_Color(Value: Integer); safecall;
    procedure Set_Cursor(Value: Smallint); safecall;
    procedure Set_DropTarget(Value: WordBool); safecall;
    procedure Set_Enabled(Value: WordBool); safecall;
    procedure Set_HelpFile(const Value: WideString); safecall;
    procedure Set_KeyPreview(Value: WordBool); safecall;
    procedure Set_PixelsPerInch(Value: Integer); safecall;
    procedure Set_PrintScale(Value: TxPrintScale); safecall;
    procedure Set_Scaled(Value: WordBool); safecall;
    procedure Set_Visible(Value: WordBool); safecall;
    procedure Set_WindowState(Value: TxWindowState); safecall;
  public
    { Public declarations }
  end;

implementation

uses ComServ;

{$R *.DFM}

{ TMain }

procedure TWinDn.EventSinkChanged(const EventSink: IUnknown);
begin
  FEvents := EventSink as IMainEvents;
end;

procedure TWinDn.Initialize;
begin
  OnActivate := ActivateEvent;
  OnClick := ClickEvent;
  OnCreate := CreateEvent;
  OnDblClick := DblClickEvent;
  OnDeactivate := DeactivateEvent;
  OnDestroy := DestroyEvent;
  OnKeyPress := KeyPressEvent;
  OnPaint := PaintEvent;
end;

function TWinDn.Get_Active: WordBool;
begin
  Result := Active;
end;

function TWinDn.Get_AutoScroll: WordBool;
begin
  Result := AutoScroll;
end;

function TWinDn.Get_AxBorderStyle: TxActiveFormBorderStyle;
begin
  Result := Ord(AxBorderStyle);
end;

function TWinDn.Get_Caption: WideString;
begin
  Result := WideString(Caption);
end;

function TWinDn.Get_Color: Integer;
begin
  Result := Integer(Color);
end;

function TWinDn.Get_Cursor: Smallint;
begin
  Result := Smallint(Cursor);
end;

function TWinDn.Get_DropTarget: WordBool;
begin
  Result := DropTarget;
end;

function TWinDn.Get_Enabled: WordBool;
begin
  Result := Enabled;
end;

function TWinDn.Get_HelpFile: WideString;
begin
  Result := WideString(HelpFile);
end;

function TWinDn.Get_KeyPreview: WordBool;
begin
  Result := KeyPreview;
end;

function TWinDn.Get_PixelsPerInch: Integer;
begin
  Result := PixelsPerInch;
end;

function TWinDn.Get_PrintScale: TxPrintScale;
begin
  Result := Ord(PrintScale);
end;

function TWinDn.Get_Scaled: WordBool;
begin
  Result := Scaled;
end;

function TWinDn.Get_Visible: WordBool;
begin
  Result := Visible;
end;

function TWinDn.Get_WindowState: TxWindowState;
begin
  Result := Ord(WindowState);
end;

procedure TWinDn.Set_AutoScroll(Value: WordBool);
begin
  AutoScroll := Value;
end;

procedure TWinDn.Set_AxBorderStyle(Value: TxActiveFormBorderStyle);
begin
  AxBorderStyle := TActiveFormBorderStyle(Value);
end;

procedure TWinDn.Set_Caption(const Value: WideString);
begin
  Caption := TCaption(Value);
end;

procedure TWinDn.Set_Color(Value: Integer);
begin
  Color := TColor(Value);
end;

procedure TWinDn.Set_Cursor(Value: Smallint);
begin
  Cursor := TCursor(Value);
end;

procedure TWinDn.Set_DropTarget(Value: WordBool);
begin
  DropTarget := Value;
end;

procedure TWinDn.Set_Enabled(Value: WordBool);
begin
  Enabled := Value;
end;

procedure TWinDn.Set_HelpFile(const Value: WideString);
begin
  HelpFile := String(Value);
end;

procedure TWinDn.Set_KeyPreview(Value: WordBool);
begin
  KeyPreview := Value;
end;

procedure TWinDn.Set_PixelsPerInch(Value: Integer);
begin
  PixelsPerInch := Value;
end;

procedure TWinDn.Set_PrintScale(Value: TxPrintScale);
begin
  PrintScale := TPrintScale(Value);
end;

procedure TWinDn.Set_Scaled(Value: WordBool);
begin
  Scaled := Value;
end;

procedure TWinDn.Set_Visible(Value: WordBool);
begin
  Visible := Value;
end;

procedure TWinDn.Set_WindowState(Value: TxWindowState);
begin
  WindowState := TWindowState(Value);
end;

procedure TWinDn.ActivateEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnActivate;
end;

procedure TWinDn.ClickEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnClick;
end;

procedure TWinDn.CreateEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnCreate;
end;

procedure TWinDn.DblClickEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnDblClick;
end;

procedure TWinDn.DeactivateEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnDeactivate;
end;

procedure TWinDn.DestroyEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnDestroy;
end;

procedure TWinDn.KeyPressEvent(Sender: TObject; var Key: Char);
var
  TempKey: Smallint;
begin
  TempKey := Smallint(Key);
  if FEvents <> nil then FEvents.OnKeyPress(TempKey);
  Key := Char(TempKey);
end;

procedure TWinDn.PaintEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnPaint;
end;

procedure TWinDn.FormCreate(Sender: TObject);
begin

 showmessage('oh');

 If Save.Execute Then
 Begin





 End;

end;

initialization
  TActiveFormFactory.Create(
    ComServer,
    TActiveFormControl,
    TWinDn,
    Class_Main,
    1,
    '',
    OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL);
end.
