Displaying a property page for a file.  

The following code provides an easy to use function that displays the properties for a file, folder or drive. This is the same dialog box that Windows Explorer displays when viewing an object's properties.

 

uses ShellAPI;
 
function ShowProperties(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;
 
 
Return to the main page


This page was created by Ashley Godfrey, 1998.
Borland Delphi is a registered trademark of Inprise Corporation
Window's 95 and Internet Explorer are registered trademarks of Microsoft Corporation
All other products and logos are the property of theor respective owners
Inprise Corporation is in no way affiliated with Ashley Godfrey, this site or any of his software.