请教各位 怎样调用系统API删除指定目录的文件,如删除F:\DB8.mdb,请给出点原代码,谢谢各位!

解决方案 »

  1.   

    BOOL DeleteFile(    LPCTSTR lpFileName  // pointer to name of file to delete  
       );
     ParameterslpFileNamePoints to a null-terminated string that specifies the file to be deleted.  Return ValuesIf the function succeeds, the return value is nonzero.
    If the function fails, the return value is zero. To get extended error information, call GetLastError.   例:
    DeleteFile('F:\DB8.mdb');
      

  2.   

    http://expert.csdn.net/Expert/topic/2494/2494130.xml?temp=.5412714
      

  3.   

    当strFileName正在被使用时,用DeleteFile可能会失败。
    改用MoveFileEx(PChar(strFileName), nil, MOVEFILE_DELAY_UNTIL_REBOOT);重启后肯定能删除掉。