unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComObj;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private 宣言 }
  public
    { Public 宣言 }
  end;

var
  Form1: TForm1;

implementation

uses CAOLib_TLB;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  CaoObj: IUnknown;
  CaoEng: ICaoEngine;
  CaoCtrl: ICaoController;
  CaoVar: ICaoVariable;

begin
  Try
    {CaoEngineの生成}
    CaoObj := CreateComObject(ProgIDToClassID('CAO.CaoEngine'));
    CaoEng := CaoObj as ICaoEngine;

    {CaoControllerの生成}
    CaoCtrl := CaoEng.Workspaces.Item(0).AddController('RC1', 'CaoProv.Dummy', '', '');

    {CaoVariableの生成}
    CaoVar := CaoCtrl.AddVariable('S11', '');

    {値の設定}
    CaoVar.Value := Edit1.text;

    {値の取得}
    Edit2.Text := CaoVar.Value;
  Except
    {エラー処理}
    ShowMessage('Error');
  End;
end;

end.
