Author: Mike Shkolnik
How display the standard Property dialog for file, folder or drive?
Answer:
Sometimes you need show the standard dialog with file properties from own
application (especially if you develop some file manager)
You may easy solve this task - just run next code:
1 2 function ShowFilePropertiesDialog(hWndOwner: HWND; const FileName: string): Boolean;
3 var4 Info: TShellExecuteInfo;
5 begin6 { Fill in the SHELLEXECUTEINFO structure }7 with Info do8 begin9 cbSize := SizeOf(Info);
10 fMask := SEE_MASK_NOCLOSEPROCESS or11 SEE_MASK_INVOKEIDLIST or12 SEE_MASK_FLAG_NO_UI;
13 wnd := hWndOwner;
14 lpVerb := 'properties';
15 lpFile := pChar(FileName);
16 lpParameters := nil;
17 lpDirectory := nil;
18 nShow := 0;
19 hInstApp := 0;
20 lpIDList := nil;
21 end;
22 23 { Call Windows to display the properties dialog. }24 Result := ShellExecuteEx(@Info);
25 end;
This is the same dialog box that Windows Explorer displays when viewing an object's
properties. For example, from this dialog user can change permissions for folder or
check free space for drive.
You may specify a file name or folder name or drive letter. For example:
26 27 ShowFilePropertiesDialog(Application.Handle, 'd:\debit.xls')
28 29 //or 30 31 ShowFilePropertiesDialog(Application.Handle, 'd:\Oracle')
32 33 //or 34 35 ShowFilePropertiesDialog(Application.Handle, 'd:\')