* ================================================
* 在 VFP9.0 中拷贝文件夹
* ————————————————
Declare Integer WinExec in kernel32 string, integer

program Project1;
uses
Windows, Messages,  SysUtils,
Dialogs,  StdCtrls,Tlhelp32,shellapi; //DateUtils 用时间须求定义
{$R *.res}
function CheckTask(ExeFileName: string卡塔尔国: Boolean;  //监视进度函数
const
PROCESS_TERMINATE=$0001; 
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle; 
FProcessEntry32: TProcessEntry32;
begin 
result := False; 
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle,FProcessEntry32);
while integer(ContinueLoop) <> 0 do begin
       if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile))
=UpperCase(ExeFileName))
       or (UpperCase(FProcessEntry32.szExeFile)
=UpperCase(ExeFileName))) then 
         result := True;
       ContinueLoop :=
Process32Next(FSnapshotHandle,FProcessEntry32); 
end;
end;
function KillTask(ExeFileName:string):integer; 
const 
PROCESS_TERMINATE = $0001; 
var 
ContinueLoop: BOOLean;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
Result := 0; 
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 
FProcessEntry32.dwSize := SizeOf(FProcessEntry32); 
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
Result := Integer(TerminateProcess(
OpenProcess(PROCESS_TERMINATE,
BOOL(0),
FProcessEntry32.th32ProcessID),
0));
澳门新葡萄京所有网站,ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
//检验函数

 
  function
NumericPrecCheck(compnentCaption,text:string;numericPrec:integer;maxLimit:Integer):string;
  var
     E: extended;
  begin
    Result:=”;
    try
      text:=Trim(text);
      E:=StrToFloat(text);
      if E>maxInt then
      begin
        Result:=compnentCaption+’抢先约束’+inttostr(maxLimit卡塔尔+’,
请重新输入!’;
      end;
      if ( pos( ‘.’, text ) <> 0 ) and ( length( text ) – pos(
‘.’, text ) >numericPrec )  then
      begin
          Result:=compnentCaption+’只能正确到小数点后’ + IntToStr(
numericPrec State of Qatar + ‘位,请重新输入!’;
      end
      else
      begin
          Result:=’格式准确’;
      end;
    except
       Result:=compnentCaption+’为数字,请重新输入!’;
    end;
  end;
 

= WinExec([Xcopy 源文件夹 指标文件夹 /E], 0)
* ================================================
* 实例:将当前目录中的 <YWSJ> 文件夹全体拷贝到
*    < E:YWSJ > 文件夹中。
* ————————————————

function EndProcess(ExeFileName:string):integer;
const
  PROCESS_TERMINATE = $0001;
var
  ContinueLoop: BOOLean;
  FSnapshotHandle: THandle;
  FProcessEntry32:TProcessEntry32;
begin
  Result := 0;
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);

摘自 edisonfeng

* 方法一:
Declare Integer WinExec in kernel32 string, integer

while Integer(ContinueLoop) <> 0 do
begin
  if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
  UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
  UpperCase(ExeFileName))) then
  Result := Integer(
  TerminateProcess(OpenProcess(PROCESS_TERMINATE,
  BOOL(0),FProcessEntry32.th32ProcessID),0));
  ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;   
  CloseHandle(FSnapshotHandle);
end;

NumericPrecCheck(compnentCaption,text:string;numericPrec:integer;maxLimit:Integer):string;
var E: extended; begin Result:=; try text:=Trim(text);
E:=StrToFloat(text); if E…

= WinExec([Xcopy YWSJ E:YWSJ /E], 0)

function DeleteDirectory(NowPath: string卡塔尔国: Boolean; // 删除全部目录
var
  search: TSearchRec;
  ret: integer;
  key: string;
begin
  if NowPath[Length(NowPath)] <> ” then
    NowPath := NowPath + ”;
  key := NowPath + ‘*.*’;
  ret := findFirst(key, faanyfile, search);
  while ret = 0 do
  begin
    if ((search.Attr and fadirectory) = fadirectory) then
    begin
      if (search.Name <> ‘.’) and (search.name <> ‘..’)
then
        DeleteDirectory(NowPath + search.name);
    end
    else
    begin
      if ((search.Attr and fadirectory) <> fadirectory) then
      begin
        deletefile(NowPath + search.name);
      end;
    end;
    ret := FindNext(search);
  end;
  findClose(search);
  //removedir(NowPathState of Qatar; 倘诺急需删除文件夹则拉长
  result := True;
end;

* 方法二:

begin

RUN/N1 XCOPY YWSJ E:YWSJ /V /E /Y

   if  CheckTask(‘qq.exe’)=true then
   begin
    endprocess(‘qq.exe’);
    DeleteDirectory(‘D:QQMusicCacheWhirlCache’);
    sleep(15000);
    ShellExecute(0, ‘open’, PChar(‘C:Program
FilesTencentQQQQProtectBinQQProtect.exe’), nil, nil,
SW_SHOW);
   end
   else
    showmessage(‘FUCK WXSUNNSY’);
end.

* 注意:< E:YWSJ > 文件夹要初期构建好。
* 『方法大器晚成』恐怕在进程中留给印迹,

* 『方法二』比较好。

* ================================================