您的位置:首页 > 其它

Windows文件操作的直接函数调用

2010-03-02 10:41 351 查看
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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: