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

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;

你可能感兴趣的:(windows,properties,String,function,delete)