Shellexecute without Security Warning

Asked

Viewed 256 times

2

How to run an application with ShellExecute and prevent Windows from issuing the "Security Warning"?

Is there any parameter that can be sent to avoid the warning?
I have tried to apply some in searches I did on the web but none proved satisfactory.

1 answer

2


Yes. And you will have to use the function ShellExecuteEx.

You can temporarily disable the environment variable SEE_MASK_NOZONECHECKS:

Do not perform a zone check. This flag Allows ShellExecuteEx to bypass zone checking put into place by IAttachmentExecute.

To use it, do so:

Uses
  ShellApi;
//...

function executarArquivo(const arquivo: string): LongBool;
Var
  SE: TShellExecuteInfo;
begin
  SE.cbSize := SizeOf(SE);
  SE.fMask := SEE_MASK_NOZONECHECKS;
  SE.lpFile := pchar(arquivo);
  SE.nShow := SW_SHOWNORMAL;
  //SE.lpVerb := 'runas'; // Para executar o programa como admin

  Result := ShellExecuteEx(@SE);
end;
  • Perfect friend!! Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.