能不能给各源程序.急啊
void __fastcall TForm1::FormCreate(TObject *Sender)
{
bool a,b;
b = true;
a = false;
if (Com->PortOpen)
Com->PortOpen = a;
Com->CommPort = 2;
if (!Com->PortOpen)
Com->PortOpen = b;
else
//Error Massage;
Com->Settings = "9600,N,8,1";
Com->InputMode = 0;
Com->InputLen = 0;
Com->RThreshold = 1;
Com->SThreshold = 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Com->Output=WideString(Edit1->Text);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Edit1->Text = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Edit2->Text = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComComm(TObject *Sender)
{
OleVariant RxBuff;
//OleVariant a=111;
//char str[80];
//ShowMessage(itoa(a,str,16));
//收到有效字符事件
if(Com->CommEvent==2)
{
RxBuff=Com->Input;
MyInput=MyInput+WideString(RxBuff);
Edit2->Text=MyInput;
}
}