Buscar

Executando o windows explorer com parâmetros

Código

Function ExecExplorer(OpenAtPath: string; OpenWithExplorer, OpenAsRoot: Boolean): boolean;
//
// Executa o Windows Explorer a partir de uma pasta
// especificada
//
// 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;

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Windows
Adicionada dia: 20/06/03
Por: Felipe Monteiro
Visualizada: 3461 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009