資源描述:
《通達信數(shù)據(jù)讀取(delphi版)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、unitUnitDataMng;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,DB,ADODB,StdCtrls,ExtCtrls,ComCtrls,Mask,DBCtrls,ComObj,Menus,CheckLst,Grids,ZAbstractRODataset,ZDataset,ZAbstractDataset,FileCtrl,ShellCtrls;typeTFormDataMng=class(TFo
2、rm)Sb1:TStatusBar;Button1:TButton;Memo1:TMemo;Button2:TButton;Button3:TButton;Memo2:TMemo;Button4:TButton;Button5:TButton;edtGpCode:TEdit;Edit1:TEdit;Memo3:TMemo;procedureButton1Click(Sender:TObject);procedureButton3Click(Sender:TObject);procedureButton2Click(Sender:TObje
3、ct);procedureButton4Click(Sender:TObject);procedureButton5Click(Sender:TObject);procedureEdit1Change(Sender:TObject);privatepublicend;typeStockData=recorddate:integer;open:integer;high:integer;low:integer;close:integer;amount:integer;vol:integer;reservation:integer;end;va
4、rFormDataMng:TFormDataMng;implementationusesUnitMain;{$R*.dfm}functionhTot(iHex:string):integer;begin//intToHex(idays,2)hTot:=0;end;procedureTFormDataMng.Button1Click(Sender:TObject);variFileHandle:Integer;//idays:word;//Buffer:PChar;idays:Longword;i:integer;beginmemo1.Cl
5、ear;tryiFileHandle:=FileOpen(ExtractFilePath(ParamStr(0))+'datash601398.day',fmOpenRead);ifiFileHandle<=0thenexit;FileSeek(iFileHandle,0,0);fori:=0to31dobeginidays:=0;FileSeek(iFileHandle,1,1);FileRead(iFileHandle,idays,1);memo1.Lines.Add(intToStr(i)+':'+intToStr(idays)
6、);end;//FileRead(iFileHandle,idays,4);//memo1.Lines.Add('日期'+intToStr(idays));FileClose(iFileHandle);exceptonE:Exceptiondoshowmessage(E.Message);end;end;procedureTFormDataMng.Button3Click(Sender:TObject);vari:integer;sHexLine,s,sMemo1Line:string;beginmemo1.Clear;fori:=0to
7、memo2.Lines.Count-1dobeginsHexLine:=trim(memo2.Lines.Strings[i]);sMemo1Line:='';//一行十六進制字符串轉(zhuǎn)換whilelength(sHexLine)>0dobegins:=copy(sHexLine,0,1);ifhTot(s)=99thensMemo1Line:=sMemo1Line+''elsesMemo1Line:=sMemo1Line+inttostr(hTot(s));//sMemo1Line:=sMemo1Line+s+':'+inttostr(h
8、Tot(s));delete(sHexLine,1,1);//memo1.Lines.Add(sHexLine);end;memo1.Lines.Add(sMemo1Line);end;end