直接在操作系统中人工删除则没有任何问题?代码:
  if RemoveDir('C:\Documents and Settings\Administrator\桌面\dde\') then
    showMessage('OK')
  else
    ShowMessage('No');  if RemoveDir('C:\Documents and Settings\Administrator\桌面\dde') then
    showMessage('OK')
  else
    ShowMessage('No');结果都是“NO”

解决方案 »

  1.   

    删除文件夹建议用SHFileOperation function   DeleteDir(Path:   String):   Boolean;   
      var   
          shfRecycleBinStruct:   TSHFileOpStruct;   
      begin   
          FillChar(shfRecycleBinStruct,SizeOf(shfRecycleBinStruct),0);   
          with   shfRecycleBinStruct   do   
          begin   
              wFunc   :=   FO_DELETE;   
              pFrom   :=   PChar(Path);   
              fFlags   :=   FOF_NOCONFIRMATION   or   FOF_SILENT;   
          end;   
          Result   :=   SHFileOperation(shfRecycleBinStruct)   =   0;   
      end;   
      

  2.   

    路径我是点中属性后Copy到程序中的,不会有问题,权限也看了,Administrator有权
      

  3.   

         FillChar(shfRecycleBinStruct,SizeOf(shfRecycleBinStruct),0);
          with  shfRecycleBinStruct  do
          begin
              wFunc  :=  FO_DELETE;
              pFrom  :=  PChar('C:\Documents and Settings\Administrator\桌面\dde');
              fFlags  :=  FOF_NOCONFIRMATION  or  FOF_SILENT;
          end;
          SHFileOperation(shfRecycleBinStruct) ;
    ShowMessage(SysErrorMessage(GetLastError));---------------------------------------------------
    错误提示:句柄无效