不用递归,用外部函数调用的方法如何删除
------解决方案--------------------
这是一个自定义对象
- C/C++ code
forwardglobal type nvo_folder from nonvisualobjectend typetype shfileopstruct from structure within nvo_folderend typeend forwardtype shfileopstruct from structure long hwnd unsignedlong wfunc string pfrom string pto unsignedlong fflags boolean fanyoperationsaborted long hnamemappings string lpszprogresstitleend typeglobal type nvo_folder from nonvisualobject autoinstantiateend typetype prototypesFunction long SHFileOperation( Ref SHFILEOPSTRUCT lpFileOp ) Library "shell32.dll " Alias For "SHFileOperationA" end prototypestype variables// 文件操作变量 Private: constant ulong FO_MOVE = 1 constant ulong FO_COPY = 2 constant ulong FO_DELETE = 3 constant ulong FO_RENAME = 4 // 文件操作标志位 Private: constant ulong FOF_MULTIDESTFILES = 1 // 0x0001 constant ulong FOF_CONFIRMMOUSE = 2 // 0x0002 constant ulong FOF_SILENT = 4 // 0x0004 constant ulong FOF_RENAMEONCOLLISION = 8 // 0x0008 constant ulong FOF_NOCONFIRMATION = 16 // 0x0010 constant ulong FOF_WANTMAPPINGHANDLE = 32 // 0x0020 constant ulong FOF_ALLOWUNDO = 64 // 0x0040 constant ulong FOF_FILESONLY = 128 // 0x0080 constant ulong FOF_SIMPLEPROGRESS = 256 // 0x0100 constant ulong FOF_NOCONFIRMMKDIR = 512 // 0x0200 constant ulong FOF_NOERRORUI = 1024 // 0x0400end variablesforward prototypespublic function boolean of_removefolder (string as_folder)end prototypespublic function boolean of_removefolder (string as_folder);//删除文件夹as_folderSHFILEOPSTRUCT FileOpFileOp.fFlags = FOF_NOCONFIRMATIONFileOp.hNameMappings = 0FileOp.hwnd = 0FileOp.lpszProgressTitle = ''FileOp.pFrom = as_folderFileOp.pTo = ''FileOp.wFunc = FO_Deletereturn SHFileOperation(FileOp) = 0end functionon nvo_folder.createcall super::createTriggerEvent( this, "constructor" )end onon nvo_folder.destroyTriggerEvent( this, "destructor" )call super::destroyend on