//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "MSCommLib_OCX"
#pragma link "PERFGRAP"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
MSComm1->PortOpen=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
int BufSize;
char Buffer[1024];
static AnsiString input;
BufSize=MSComm1->InBufferSize;
if (BufSize>0)
input+=MSComm1->Input;
while (input.Pos("\n")>0)
{
int count=input.Pos("\n");
AnsiString string =input.SubString(1,count);
int index1=string.Pos("3s=")+3;
if (index1>3)
{
int index2=string.Pos("60s=")+4;
int index3=string.Pos(" s=");
int count1=index2-index1-5;
int count2=index3-index2;
int value1=string.SubString(index1,count1).ToInt();
int value2=string.SubString(index2,count2).ToInt();
Form1->Caption=string;
Edit1->Text = value1-value2;
// PerformanceGraph1->DataPoint(clRed,value1);
// PerformanceGraph1->DataPoint(clYellow,value2);
PerformanceGraph1->DataPoint(clWhite,10*(10000+value1-value2));
PerformanceGraph1->Update();
}
input.Delete(1,count);
}
}
//---------------------------------------------------------------------------
macd.zip_MSCOMM32.OCX CB_macd_mscomm32 C++builder
版权申诉
43 浏览量
2022-09-20
16:14:40
上传
评论
收藏 1.28MB ZIP 举报

JaniceLu
- 粉丝: 65
- 资源: 1万+