constructor pos_cj.create(COM_232:string);
unit pos_thread;
interface
uses
Classes,Graphics,Qforms,sysutils,variants,windows,Dialogs;
type
pos_cj = class(TThread)
private
COM:string;
//flag_true:boolean;
pos_handle:integer;
sys_232:string;
{ Private declarations }
protected
procedure sjcj;
procedure Execute; override;
public
constructor create(COM_232:string);
end;
implementation
uses Pos, Urfdll, fun, datamodulefrm, report, datamoduledic_frm;
{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure pos.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ pos }
constructor pos_cj.create(COM_232:string);
begin
COM:=COM_232;
inherited create(true);
freeonterminate:=true;
end;
procedure pos_cj.sjcj;
begin
try
finally
freeonterminate:=true;
//showmessage('上传数据失败!!!');
code:=link_close(pos_handle);
end; //try
end; //begin //--pos_cj.sjcj--//
procedure pos_cj.Execute;
var
i : integer;
begin
freeonterminate:=true;
//entercriticalsection(cs);
for i:=1 to 2 do
begin
Com:='COM'+inttostr(i);
synchronize(sjcj);
end;
//leavecriticalsection(cs);
end;
end.
我只是将结构传给你,希望你能解决你的问题.
我想你对我的实际内容是不会感兴趣的.