改成 FO_MOVE<br><br>复制的例子,将FO_COPY改成FO_MOVE就成了移动了。<br>uses shellapi;<br><br>function CopyFile(SourceName, TargetName: string): Boolean;<br>var<br> F: TShFileOpStruct;<br>begin<br> F.wnd := Form1.Handle;<br> F.wFunc := FO_COPY; {操作方式}<br> F.pFrom := PChar(SourceName + #0#0);<br> F.pTo := PChar(TargetName + #0#0);<br> F.fFlags := FOF_ALLOWUNDO or FOF_RENAMEONCOLLISION;<br> result := ShFileOperation(F) = 0;<br>end;<br><br><br>{ TForm1 }<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> CopyFile('E:/Temp', 'E:/Tmp');<br>end;<br>