C++Builder



         


- TEdit, TCheckBox, TOpenDialog, TSaveDialog, .

wpe7.jpg (23966 bytes)

, ( h- ComObj):

//#include <vcl.h>

#pragma hdrstop

#include <ComObj.hpp>

#include autocon.h

//#pragma package(smart_init)

#pragma resource *.dfm

TForm2 *Form2;

Variant Serv;

//__fastcall TForm2::TForm2(TComponent* Owner)

: TForm(Owner)

{

}

//

void __fastcall TForm2::Button3Click(TObject *Sender)

{

Serv=CreateOleObject(Project1.MyAuto3);

}

//

void __fastcall TForm2::Button1Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) Edit1->Text=IntToStr(Serv.OlePropertyGet(Width));

// ,

//

}

//

void __fastcall TForm2::Button2Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) Serv.OlePropertySet(Width,StrToInt(Edit1->Text));

}

//

void __fastcall TForm2::Button12Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) CheckBox1->Checked=Serv.OlePropertyGet(Visible);

}

//

void __fastcall TForm2::Button13Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) Serv.OlePropertySet(Visible,CheckBox1->Checked);

}

//

void __fastcall TForm2::Button11Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) Serv=Unassigned;

}

//

void __fastcall TForm2::Button5Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch)

{if (OpenDialog1->Execute())

Serv.OleProcedure(OpenFile,OpenDialog1->FileName);}

}

//

void __fastcall TForm2::Button6Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch)

{ if (SaveDialog1->Execute())

Serv.OleProcedure(SaveFile,SaveDialog1->FileName);}

}

//

void __fastcall TForm2::Button7Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) Serv.OleProcedure(NewFile);

}

//

void __fastcall TForm2::Button4Click(TObject *Sender)

{

if (VarType(Serv)==varDispatch) Serv.OleProcedure(AddLine,Edit1->Text);

}

//