--> Open Containing Folder by delphi | Delphi Tips Trick

For Newbie

Tuesday 15 November 2011

Open Containing Folder by delphi

| Tuesday 15 November 2011


Tricks to open the directory and its files / folders that have happened-select (such as when to execute the menu Open Containing Folder in Windows search results).

Function declaration:
OpenContainingFolder procedure (FileName: String);
begin
   ShellExecute (Application.Handle, nil, 'explorer',
                PChar ('/ select, "' + FileName +'"'), nil, SW_SHOWNORMAL);
end;

Add ShellAPI units in uses.

Example of implementation:
procedure TForm1.Button1Click (Sender: TObject);
begin
   OpenContainingFolder ('C: \ WINDOWS');
end;

Related Posts

No comments: