1、调用文件属性对话框
procedure OpenWindowsFilePropertys(FileName: string); var sei: TSHELLEXECUTEINFO; begin ZeroMemory(@sei, sizeof(sei)); sei.cbSize := sizeof(sei); sei.lpFile := PChar(FileName); sei.lpVerb := 'properties'; sei.fMask := SEE_MASK_INVOKEIDLIST; ShellExecuteEx(@sei); end;
2、删除文件或文件夹到回收站
function ShellDeleteFileOrDir(const Source: string): boolean; var fo: TSHFILEOPSTRUCT; begin FillChar(fo, SizeOf(fo), 0); with fo do begin Wnd := 0; wFunc := FO_DELETE; pFrom := PChar(source + #0); pTo := #0#0; fFlags := FOF_NOCONFIRMATION + FOF_ALLOWUNDO; end; Result := (SHFileOperation(fo) = 0); end;
本文介绍了使用Delphi进行文件及文件夹操作的方法,包括如何调用Windows文件属性对话框及如何将文件或文件夹安全地移至回收站,为开发者提供了实用的代码示例。
3万+

被折叠的 条评论
为什么被折叠?



