問的不太好?<br> 我的一個文件夾裡面的子文件夾正好是打開的,可是我要刪除它,就出錯!<br>看過程:<br>procedure ToRecycle(AHandle: THandle; const ADirName: String);<br>var<br> SHFileOpStruct: TSHFileOpStruct;<br> DirName: PChar;<br> BufferSize: Cardinal;<br>begin<br> BufferSize := Length(ADirName) +1 +1;<br> GetMem(DirName, BufferSize);<br> try<br> FillChar(DirName^, BufferSize, 0);<br> StrCopy(DirName, PChar(ADirName));<br><br> with SHFileOpStruct do<br> begin<br> Wnd := AHandle;<br> wFunc := FO_DELETE;<br> pFrom := DirName;<br> pTo := nil;<br> fFlags := FOF_NOCONFIRMATION;<br><br> fAnyOperationsAborted := False;<br> hNameMappings := nil;<br> lpszProgressTitle := nil;<br> end;<br> SHFileOperation(SHFileOpStruct)<br> finally<br> FreeMem(DirName, BufferSize);<br> end;<br>end;<br>我不想出Last win32 Error! 如果知道它沒有被使用或共享就call此過程 這樣才會不彈出消息!