For Newbie

Tuesday, 15 November 2011

Open Containing Folder by delphi



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;

Share on Facebook
Share on Twitter
Share on Google+

Related : Open Containing Folder by delphi