|
| to display a Property dialog for file, folder or drive |  
|
|---|
Product: Delphi all versions | Category: Shell API | Skill Level:
 | Scoring:  | Last Update: 04/19/2003 | Search Keys: delphi delphi3000 article borland vcl code-snippet property dialog file drive folder ShowFilePropertiesDialog SHELLEXECUTEINFO ShellExecuteEx SEE_MASK_NOCLOSEPROCESS SEE_MASK_INVOKEIDLIST SEE_MASK_FLAG_NO_UI TShellExecuteInfo | Times Scored: 2 | Visits: 3042 | Uploader: Mike Shkolnik Company: Scalabium Software | Reference: http://www.scalabium.com/faq/dct0151.htm | | | Question/Problem/Abstract:
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:
function ShowFilePropertiesDialog(hWndOwner: HWND; const FileName: string): Boolean;
var
Info: TShellExecuteInfo;
begin
{ Fill in the SHELLEXECUTEINFO structure }
with Info do
begin
cbSize := SizeOf(Info);
fMask := SEE_MASK_NOCLOSEPROCESS or
SEE_MASK_INVOKEIDLIST or
SEE_MASK_FLAG_NO_UI;
wnd := hWndOwner;
lpVerb := 'properties';
lpFile := pChar(FileName);
lpParameters := nil;
lpDirectory := nil;
nShow := 0;
hInstApp := 0;
lpIDList := nil;
end;
{ Call Windows to display the properties dialog. }
Result := ShellExecuteEx(@Info);
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:
ShowFilePropertiesDialog(Application.Handle, 'd:\debit.xls')
or
ShowFilePropertiesDialog(Application.Handle, 'd:\Oracle')
or
ShowFilePropertiesDialog(Application.Handle, 'd:\')
|
|
|
| |
Sign up to consume product discounts for Bronze memberships !
|
|
| |
Community Ad of M. Shkolnik |
|
| |
|
|
|