C++Builder - 2


//

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);

}

//

, . Variant ( C++Builder ) CreateOleObject, ComObj VCL.

CreateOleObject . , Win32 API, COM- IDispatch . , , ( ), . CreateOleObject ComObj, , , , Win32 API CoCreateInstance, COM, DLL. Variant (, ., COM-).