pb怎么删除非空文件夹
pb如何删除非空文件夹
不用递归,用外部函数调用的方法如何删除
------解决方案--------------------
这是一个自定义对象
不用递归,用外部函数调用的方法如何删除
------解决方案--------------------
这是一个自定义对象
- C/C++ code
forward global type nvo_folder from nonvisualobject end type type shfileopstruct from structure within nvo_folder end type end forward type shfileopstruct from structure long hwnd unsignedlong wfunc string pfrom string pto unsignedlong fflags boolean fanyoperationsaborted long hnamemappings string lpszprogresstitle end type global type nvo_folder from nonvisualobject autoinstantiate end type type prototypes Function long SHFileOperation( Ref SHFILEOPSTRUCT lpFileOp ) Library "shell32.dll " Alias For "SHFileOperationA" end prototypes type 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 // 0x0400 end variables forward prototypes public function boolean of_removefolder (string as_folder) end prototypes public function boolean of_removefolder (string as_folder);//删除文件夹as_folder SHFILEOPSTRUCT FileOp FileOp.fFlags = FOF_NOCONFIRMATION FileOp.hNameMappings = 0 FileOp.hwnd = 0 FileOp.lpszProgressTitle = '' FileOp.pFrom = as_folder FileOp.pTo = '' FileOp.wFunc = FO_Delete return SHFileOperation(FileOp) = 0 end function on nvo_folder.create call super::create TriggerEvent( this, "constructor" ) end on on nvo_folder.destroy TriggerEvent( this, "destructor" ) call super::destroy end on