O
oocoolie
Unregistered / Unconfirmed
GUEST, unregistred user!
调用时使用
Threadmove:=Tmovefile.Create(true);
Threadmove.setVar(source,dest,0);
Threadmove.Resume;
出现abstract error;
另外,想请问waitfor的用法
unit UntObjMoveFile;
interface
uses
Classes,shellapi,Sysutils;
type
TMoveFile = class(TThread)
private
m_source:string;
m_dest:string;
m_Action:integer;
{ Private declarations }
protected
procedure Execute;
override;
public
Procedure MovePro;
procedure setVar(Source,dest:string;Action:integer);
end;
implementation
uses
untservermain;
{ Important: Methods and properties of objects in VCL can only be used in a
method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure MoveFile.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}
{ TMoveFile }
procedure TMoveFile.Execute;
begin
inherited;
if (m_source='') or (m_dest='') then
begin
returnvalue:=0;
exit;
end;
Synchronize(movepro);
end;
procedure TMoveFile.MovePro;
var
shfileopstruct:TshfileOpstruct;
begin
shfileopstruct.Wnd:=FrmserverMain.Handle;
shFileOpstruct.pFrom:=pchar(m_source);
shFileOpstruct.pTo:=pchar(m_dest);
if m_action=0 then
shFileOpstruct.wFunc:=FO_MOVE;
if m_action=1 then
shFileOpstruct.wFunc:=FO_COPY;
shfileopstruct.fFlags:=FOF_NOCONFIRMMKDIR+FOF_NOCONFIRMATION;
if shFileOperation(shfileopstruct)<>0 then
returnvalue:=0
else
returnvalue:=1;
end;
procedure TMoveFile.setVar(Source, dest: string;
Action: integer);
begin
m_source:=trim(source);
m_dest:=(dest);
m_Action:=(Action);
FreeOnTerminate:=true;
end;
end.
Threadmove:=Tmovefile.Create(true);
Threadmove.setVar(source,dest,0);
Threadmove.Resume;
出现abstract error;
另外,想请问waitfor的用法
unit UntObjMoveFile;
interface
uses
Classes,shellapi,Sysutils;
type
TMoveFile = class(TThread)
private
m_source:string;
m_dest:string;
m_Action:integer;
{ Private declarations }
protected
procedure Execute;
override;
public
Procedure MovePro;
procedure setVar(Source,dest:string;Action:integer);
end;
implementation
uses
untservermain;
{ Important: Methods and properties of objects in VCL can only be used in a
method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure MoveFile.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}
{ TMoveFile }
procedure TMoveFile.Execute;
begin
inherited;
if (m_source='') or (m_dest='') then
begin
returnvalue:=0;
exit;
end;
Synchronize(movepro);
end;
procedure TMoveFile.MovePro;
var
shfileopstruct:TshfileOpstruct;
begin
shfileopstruct.Wnd:=FrmserverMain.Handle;
shFileOpstruct.pFrom:=pchar(m_source);
shFileOpstruct.pTo:=pchar(m_dest);
if m_action=0 then
shFileOpstruct.wFunc:=FO_MOVE;
if m_action=1 then
shFileOpstruct.wFunc:=FO_COPY;
shfileopstruct.fFlags:=FOF_NOCONFIRMMKDIR+FOF_NOCONFIRMATION;
if shFileOperation(shfileopstruct)<>0 then
returnvalue:=0
else
returnvalue:=1;
end;
procedure TMoveFile.setVar(Source, dest: string;
Action: integer);
begin
m_source:=trim(source);
m_dest:=(dest);
m_Action:=(Action);
FreeOnTerminate:=true;
end;
end.