quarta-feira, 25 de novembro de 2009

Executa o windows explorer a partir de uma pasta especificada

Function ExecExplorer(OpenAtPath: string; OpenWithExplorer, OpenAsRoot: Boolean): boolean;
// Requer a unit ShellApi
// ex: execExplorer('C:Temp', True,True);
var
s: string;
begin
if OpenWithExplorer then
begin
if OpenAsRoot then
s := ' /e,/root,"' + OpenAtPath + '"'
else
s := ' /e,"' + OpenAtPath + '"';
end
else
s := '"' + OpenAtPath + '"';
result := ShellExecute(Application.Handle,PChar('open'),PChar('explorer.exe'),PChar(s),nil,SW_NORMAL) > 32;
end;

Nenhum comentário:

Postar um comentário