[Hint] UnitThread.pas(119): Value assigned to 'PHandle' never used [Hint] UnitThread.pas(107): Value assigned to 'MixMacFile' never used [Hint] UnitThread.pas(155): Variable 'tempfile' is declared but never used in 'UniteByteFiles' [Error] UnitThread.pas(276): Incompatible types: '_FILETIME' and 'PChar' [Error] UnitThread.pas(285): EXCEPT or FINALLY expected [Error] UnitThread.pas(286): 'UNTIL' expected but 'EXCEPT' found [Error] UnitThread.pas(287): 'END' expected but 'UNTIL' found [Error] UnitThread.pas(289): ';' expected but 'IF' found [Error] UnitThread.pas(292): Undeclared identifier: 'TempFilePath' [Error] UnitThread.pas(292): Missing operator or semicolon [Error] UnitThread.pas(293): '.' expected but 'ELSE' found [Error] UnitThread.pas(294): Undeclared identifier: 'TESTMODE' [Error] UnitThread.pas(295): Undeclared identifier: 'Temp' [Error] UnitThread.pas(300): Undeclared identifier: 'FileName' [Error] UnitThread.pas(302): '(' expected but ')' found [Error] UnitThread.pas(302): Incompatible types: 'Boolean' and 'PChar' [Error] UnitThread.pas(304): 'OF' expected but identifier 'Count' found [Error] UnitThread.pas(305): Undeclared identifier: 'TmpMixMacFileBool' [Error] UnitThread.pas(305): Not enough actual parameters [Error] UnitThread.pas(306): Undeclared identifier: 'FileName_Ex' [Error] UnitThread.pas(307): EXCEPT or FINALLY expected [Error] UnitThread.pas(312): Missing operator or semicolon [Error] UnitThread.pas(313): Undeclared identifier: 'UniteFilePath' [Error] UnitThread.pas(314): Undeclared identifier: 'ParseUniteFilePath' [Error] UnitThread.pas(316): Undeclared identifier: 'LoginMode' [Warning] UnitThread.pas(316): Comparing signed and unsigned types - widened both operands [Error] UnitThread.pas(323): Undeclared identifier: 'TransIsSucceed' [Error] UnitThread.pas(328): 'END' expected but 'EXCEPT' found [Warning] UnitThread.pas(332): Text after final 'END.' - ignored by compiler [Fatal Error] P_ExamStation.dpr(9): Could not compile used unit 'UnitThread.pas'
谢谢大家,改得差不多了,还剩三个错误,改不了。 贴一个函数吧,代码太多。 //读取监听数据 Function ThreadCardio(P:Pointer):Longint;stdcall; var I, M :Integer; File1,File2,File3,Temp, FileName, FileName_Ex : String; Year,Month,Day,Hour,Min,Sec,Msec : Word; TempFilePath : TStringList; TmpMixMacFileBool : Boolean; MACDataPath : String; //MAC数据存放路径 UniteFilePath : String; //原始合并文件 ParseUniteFilePath : String;//解压合并文件 TESTMODE : Integer; //检查类型 Cardio_ID:Integer; Cardiogramdatafilename:PChar; //获取的CADIO文件名 DeviceType : String; //设备类型 DeviceNo : String; //设备编号 PortName : String; //通讯端口号 PortBaudrate : Integer; //通讯端口速率 TransIsSucceed:Boolean; LoginMode:Integer; // 登录模式 Date: TDateTime; Time: TDateTime; begin TransIsSucceed := False; TmpMixMacFileBool := False; DecodeDate(Date,Year,Month,Day); DecodeTime(Time,Hour,Min,Sec,Msec); FileName := 'Unite' + IntTostr(Year)+IntTostr(Month)+IntToStr(Day)+IntToStr(Hour)+IntToStr(Min)+IntToStr(Sec)+'.tmp'; FileName_Ex := 'Unite' + IntTostr(Year)+IntTostr(Month)+IntToStr(Day)+IntToStr(Hour)+IntToStr(Min)+IntToStr(Sec)+'_Ex.tmp'; FileName := MACDataPath + FileName; FileName_Ex := MACDataPath + FileName_Ex; UniteFilePath := ''; ParseUniteFilePath := ''; LoginMode:=1; Try TempFilePath := TStringList.Create; M := 0; repeat Try begin if TestMode <=1 then begin Frm_ExamStation.Memo_Info.Text := '正在从心电图机接收数据(ESC取消)......'; Cardiogramdatafilename := allocmem(255); end; if StrPos(PChar(DeviceType),'MAC') <>nil then begin Cardio_ID := Ord(VGetCardiogramData(Cardiogramdatafilename)); //读取MAC数据 end; //判断传输是否成功 if (Cardio_ID = 0) or (StrPos(PChar(Cardiogramdatafilename),'ERROR')<>nil) or (StrPos(PChar(Cardiogramdatafilename),'E*R*R*O*R')<>nil) then Begin if TestMode<=1 then begin Frm_ExamStation.Memo_Info.Text := '接收数据出错!'; end; try FreeMem(Cardiogramdatafilename); Except End; Break; End else begin if TESTMODE <= 1 then begin Frm_ExamStation.Memo_Info.Text := '正在从MAC机传输数据(ESC取消)......'; end; If (StrPos(PChar(Cardiogramdatafilename),'ERROR')<>nil) or (StrPos(PChar(Cardiogramdatafilename),'E*R*R*O*R')<>nil) Then Begin try FreeMem(Cardiogramdatafilename); Except End; Break; End; if CompareFileTime(Cardiogramdatafilename) then begin //判断数据文件的时间 Inc(M); TempFilePath.Add(Cardiogramdatafilename); end; {else begin //if Frm_ExamStation.Msgbox('该数据可能不属于该病人,是否继续!','提醒',1,2)= 'IDYES' then if Application.MessageBox('该数据可能不属于该病人,是否继续?', '提示', MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON1) = IDYES then begin Inc(M); TempFilePath.Add(Cardiogramdatafilename); end; end;} end; end; Except end; Until M>TestMode; //关闭进程 if TempFilePath.Count <>TESTMODE+1 then begin Frm_ExamStation.Memo_Info.Text := '传输数据失败!'; TempFilePath.Clear; end else begin Case TESTMODE of //开始合并文件 0 : Temp := '正常'; 1 : Temp := '15导'; 2 : Temp := '18导'; end; if UniteByteFiles(TempFilePath,Temp,FileName) then begin //合并原始数据 try if StrPos(PChar(DeviceType),'MAC') <>nil then begin Case TempFilePath.Count of 1: TmpMixMacFileBool := MixMacFile(TempFilePath.Strings[0],'NULL','NULL',FileName_Ex); 2: TmpMixMacFileBool := MixMacFile(TempFilePath.Strings[0],TempFilePath.Strings[1],'NULL',FileName_Ex); 3: TmpMixMacFileBool := MixMacFile(TempFilePath.Strings[0],TempFilePath.Strings[1],TempFilePath.Strings[2],FileName_Ex); end; if TmpMixMacFileBool then TmpMixMacFileBool :=LoadMACDataFile(FileName_Ex); end; Frm_ExamStation.Memo_Info.Text := '解压合并数据...'; if Not TmpMixMacFileBool then begin Frm_ExamStation.Memo_Info.Text := '解压合并文件出错!'; end begin UniteFilePath := FileName; ParseUniteFilePath := FileName_Ex; end; if LoginMode = 2 then //本地模式处理数据 begin if Not MACDataManage(Trim(Frm_ExamStation.Hospital_ID.Text)) then begin Frm_ExamStation.Memo_Info.Text := '处理数据出现异常!'; end else begin Frm_ExamStation.Memo_Info.Text := '传输数据完毕!'; TransIsSucceed := True; end; end else begin //网络模式直接上传服务器 Frm_ExamStation.Memo_Info.Text := '传输数据完毕!'; TransIsSucceed := True; end; Except DeleteFile(FileName); Frm_ExamStation.Memo_Info.Text := '合并文件出错!'; TempFilePath.Clear; end; end else begin Frm_ExamStation.Memo_Info.Text := '合并文件出错!'; TempFilePath.Clear; end; end; Frm_ExamStation.Memo_Info.Text := '释放资源!'; if StrPos(PChar(DeviceType),'MAC') <>nil then begin VCancelReceiveCardiogramData(); VStopReceiveCardiogramData(); //释放通讯端口 end; if TransIsSucceed then begin Frm_ExamStation.Memo_Info.Text := '传输成功!'; end else begin Frm_ExamStation.Memo_Info.Text := '传输失败!'; end; Frm_ExamStation.SetTransfersInterFace(False); //结束监听数据及界面设置 TempFilePath.Free; if hthread<>0 then I := Ord(TerminateThread(hthread,0)); try FreeMem(Cardiogramdatafilename);Except End; try Frm_ExamStation.Memo_Info.Text := '传输数据失败!'; TempFilePath.Clear; except end; except end; end;
控件需要先注册的。只剩下这俩错误了 [Error] UnitThread.pas(326): Missing operator or semicolon [Fatal Error] P_ExamStation.dpr(10): Could not compile used unit 'UnitThread.pas'
Query.Parameters.ParamByName('FileStreamDiagnose').LoadFromFile(FileStreamDiagnose,ftString);Incompatible types: 'String' and 'TMemoryStream'类型不匹配,有什么办法解决?
[Warning] UnitThread.pas(316): Comparing signed and unsigned types - widened both operands [Error] UnitThread.pas(323): Undeclared identifier: 'TransIsSucceed' [Error] UnitThread.pas(328): 'END' expected but 'EXCEPT' found [Warning] UnitThread.pas(332): Text after final 'END.' - ignored by compiler [Fatal Error] P_ExamStation.dpr(9): Could not compile used unit 'UnitThread.pas' //================================================ 应该是如下: beginend; 没有配对吧............
Query.Parameters.ParamByName('FileStreamDiagnose').LoadFromFile(FileStreamDiagnose,ftString);Incompatible types: 'String' and 'TMemoryStream'类型不匹配,有什么办法解决?=>改成:Query.Parameters.ParamByName('FileStreamDiagnose').LoadFromStream(FileStreamDiagnose,ftString);
[Hint] UnitThread.pas(107): Value assigned to 'MixMacFile' never used
[Hint] UnitThread.pas(155): Variable 'tempfile' is declared but never used in 'UniteByteFiles'
[Error] UnitThread.pas(276): Incompatible types: '_FILETIME' and 'PChar'
[Error] UnitThread.pas(285): EXCEPT or FINALLY expected
[Error] UnitThread.pas(286): 'UNTIL' expected but 'EXCEPT' found
[Error] UnitThread.pas(287): 'END' expected but 'UNTIL' found
[Error] UnitThread.pas(289): ';' expected but 'IF' found
[Error] UnitThread.pas(292): Undeclared identifier: 'TempFilePath'
[Error] UnitThread.pas(292): Missing operator or semicolon
[Error] UnitThread.pas(293): '.' expected but 'ELSE' found
[Error] UnitThread.pas(294): Undeclared identifier: 'TESTMODE'
[Error] UnitThread.pas(295): Undeclared identifier: 'Temp'
[Error] UnitThread.pas(300): Undeclared identifier: 'FileName'
[Error] UnitThread.pas(302): '(' expected but ')' found
[Error] UnitThread.pas(302): Incompatible types: 'Boolean' and 'PChar'
[Error] UnitThread.pas(304): 'OF' expected but identifier 'Count' found
[Error] UnitThread.pas(305): Undeclared identifier: 'TmpMixMacFileBool'
[Error] UnitThread.pas(305): Not enough actual parameters
[Error] UnitThread.pas(306): Undeclared identifier: 'FileName_Ex'
[Error] UnitThread.pas(307): EXCEPT or FINALLY expected
[Error] UnitThread.pas(312): Missing operator or semicolon
[Error] UnitThread.pas(313): Undeclared identifier: 'UniteFilePath'
[Error] UnitThread.pas(314): Undeclared identifier: 'ParseUniteFilePath'
[Error] UnitThread.pas(316): Undeclared identifier: 'LoginMode'
[Warning] UnitThread.pas(316): Comparing signed and unsigned types - widened both operands
[Error] UnitThread.pas(323): Undeclared identifier: 'TransIsSucceed'
[Error] UnitThread.pas(328): 'END' expected but 'EXCEPT' found
[Warning] UnitThread.pas(332): Text after final 'END.' - ignored by compiler
[Fatal Error] P_ExamStation.dpr(9): Could not compile used unit 'UnitThread.pas'
MAC?
发我邮箱我看看,[email protected]
Function ThreadCardio(P:Pointer):Longint;stdcall;
var
I, M :Integer;
File1,File2,File3,Temp, FileName, FileName_Ex : String;
Year,Month,Day,Hour,Min,Sec,Msec : Word;
TempFilePath : TStringList;
TmpMixMacFileBool : Boolean; MACDataPath : String; //MAC数据存放路径
UniteFilePath : String; //原始合并文件
ParseUniteFilePath : String;//解压合并文件
TESTMODE : Integer; //检查类型
Cardio_ID:Integer;
Cardiogramdatafilename:PChar; //获取的CADIO文件名
DeviceType : String; //设备类型
DeviceNo : String; //设备编号
PortName : String; //通讯端口号
PortBaudrate : Integer; //通讯端口速率
TransIsSucceed:Boolean;
LoginMode:Integer; // 登录模式
Date: TDateTime;
Time: TDateTime; begin
TransIsSucceed := False;
TmpMixMacFileBool := False;
DecodeDate(Date,Year,Month,Day);
DecodeTime(Time,Hour,Min,Sec,Msec);
FileName := 'Unite' + IntTostr(Year)+IntTostr(Month)+IntToStr(Day)+IntToStr(Hour)+IntToStr(Min)+IntToStr(Sec)+'.tmp';
FileName_Ex := 'Unite' + IntTostr(Year)+IntTostr(Month)+IntToStr(Day)+IntToStr(Hour)+IntToStr(Min)+IntToStr(Sec)+'_Ex.tmp';
FileName := MACDataPath + FileName;
FileName_Ex := MACDataPath + FileName_Ex;
UniteFilePath := '';
ParseUniteFilePath := '';
LoginMode:=1;
Try
TempFilePath := TStringList.Create;
M := 0;
repeat
Try
begin
if TestMode <=1 then
begin
Frm_ExamStation.Memo_Info.Text := '正在从心电图机接收数据(ESC取消)......';
Cardiogramdatafilename := allocmem(255);
end;
if StrPos(PChar(DeviceType),'MAC') <>nil then
begin
Cardio_ID := Ord(VGetCardiogramData(Cardiogramdatafilename)); //读取MAC数据
end;
//判断传输是否成功
if (Cardio_ID = 0) or (StrPos(PChar(Cardiogramdatafilename),'ERROR')<>nil) or (StrPos(PChar(Cardiogramdatafilename),'E*R*R*O*R')<>nil) then
Begin
if TestMode<=1 then
begin
Frm_ExamStation.Memo_Info.Text := '接收数据出错!';
end;
try FreeMem(Cardiogramdatafilename);
Except
End;
Break;
End
else
begin
if TESTMODE <= 1 then
begin
Frm_ExamStation.Memo_Info.Text := '正在从MAC机传输数据(ESC取消)......';
end;
If (StrPos(PChar(Cardiogramdatafilename),'ERROR')<>nil) or (StrPos(PChar(Cardiogramdatafilename),'E*R*R*O*R')<>nil) Then
Begin
try
FreeMem(Cardiogramdatafilename);
Except
End;
Break;
End;
if CompareFileTime(Cardiogramdatafilename) then
begin //判断数据文件的时间
Inc(M);
TempFilePath.Add(Cardiogramdatafilename);
end;
{else
begin
//if Frm_ExamStation.Msgbox('该数据可能不属于该病人,是否继续!','提醒',1,2)= 'IDYES' then
if Application.MessageBox('该数据可能不属于该病人,是否继续?', '提示', MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON1) = IDYES then
begin
Inc(M);
TempFilePath.Add(Cardiogramdatafilename);
end;
end;}
end;
end;
Except
end;
Until M>TestMode;
//关闭进程
if TempFilePath.Count <>TESTMODE+1 then
begin
Frm_ExamStation.Memo_Info.Text := '传输数据失败!';
TempFilePath.Clear;
end else begin
Case TESTMODE of //开始合并文件
0 : Temp := '正常';
1 : Temp := '15导';
2 : Temp := '18导';
end; if UniteByteFiles(TempFilePath,Temp,FileName) then begin //合并原始数据
try
if StrPos(PChar(DeviceType),'MAC') <>nil then
begin
Case TempFilePath.Count of
1: TmpMixMacFileBool := MixMacFile(TempFilePath.Strings[0],'NULL','NULL',FileName_Ex);
2: TmpMixMacFileBool := MixMacFile(TempFilePath.Strings[0],TempFilePath.Strings[1],'NULL',FileName_Ex);
3: TmpMixMacFileBool := MixMacFile(TempFilePath.Strings[0],TempFilePath.Strings[1],TempFilePath.Strings[2],FileName_Ex);
end;
if TmpMixMacFileBool then TmpMixMacFileBool :=LoadMACDataFile(FileName_Ex);
end;
Frm_ExamStation.Memo_Info.Text := '解压合并数据...';
if Not TmpMixMacFileBool then
begin
Frm_ExamStation.Memo_Info.Text := '解压合并文件出错!';
end begin
UniteFilePath := FileName;
ParseUniteFilePath := FileName_Ex;
end;
if LoginMode = 2 then //本地模式处理数据
begin
if Not MACDataManage(Trim(Frm_ExamStation.Hospital_ID.Text)) then
begin
Frm_ExamStation.Memo_Info.Text := '处理数据出现异常!';
end else begin
Frm_ExamStation.Memo_Info.Text := '传输数据完毕!';
TransIsSucceed := True;
end;
end else begin //网络模式直接上传服务器
Frm_ExamStation.Memo_Info.Text := '传输数据完毕!';
TransIsSucceed := True;
end;
Except
DeleteFile(FileName);
Frm_ExamStation.Memo_Info.Text := '合并文件出错!';
TempFilePath.Clear;
end; end else begin
Frm_ExamStation.Memo_Info.Text := '合并文件出错!';
TempFilePath.Clear;
end; end;
Frm_ExamStation.Memo_Info.Text := '释放资源!';
if StrPos(PChar(DeviceType),'MAC') <>nil then
begin
VCancelReceiveCardiogramData();
VStopReceiveCardiogramData(); //释放通讯端口
end;
if TransIsSucceed then
begin
Frm_ExamStation.Memo_Info.Text := '传输成功!';
end else begin
Frm_ExamStation.Memo_Info.Text := '传输失败!';
end;
Frm_ExamStation.SetTransfersInterFace(False); //结束监听数据及界面设置
TempFilePath.Free;
if hthread<>0 then I := Ord(TerminateThread(hthread,0));
try FreeMem(Cardiogramdatafilename);Except End;
try
Frm_ExamStation.Memo_Info.Text := '传输数据失败!';
TempFilePath.Clear;
except
end; except
end;
end;
如果 D7和D2010P打开同样的源码 也会有一个提示错误信息
[Error] UnitThread.pas(326): Missing operator or semicolon
[Fatal Error] P_ExamStation.dpr(10): Could not compile used unit 'UnitThread.pas'
[Error] UnitThread.pas(323): Undeclared identifier: 'TransIsSucceed'
[Error] UnitThread.pas(328): 'END' expected but 'EXCEPT' found
[Warning] UnitThread.pas(332): Text after final 'END.' - ignored by compiler
[Fatal Error] P_ExamStation.dpr(9): Could not compile used unit 'UnitThread.pas'
//================================================
应该是如下:
beginend;
没有配对吧............