1. Home
  2. Computing & Technology
  3. Delphi Programming

Display standard Windows Properties dialog

By Zarko Gajic, About.com

Here's the code that will display the standard Windows Properties dialog for a specified file (object) name.

Usage:
ShowProperties(Application.Handle, 'c:\autoexec.bat')

~~~~~~~~~~~~~~~~~~~~~~~~~
function ShowProperties
          (hWndOwner: HWND; const FileName: string)
          : boolean;
var
   Info: TShellExecuteInfo;
   Handle : THandle;
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;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to draw rotated text
« How to check whether a string is all "upper case"

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2003 Delphi Tips
  7. Display standard Windows Properties dialog

©2009 About.com, a part of The New York Times Company.

All rights reserved.