Delphi Computer Shutdown Problem

Asked

Viewed 138 times

1

I am using the following code to shut down the computer via Delphi program:

//Adicionar à cláusula Uses, Shellapi e digitar os parâmetros abaixo no clique de um botão por exemplo:

// Desliga o Windows
ExitWindowsEx(EWX_SHUTDOWN, 0);

But the computer does not turn off, it just closes the session and opens a new.

Is there any alternative for the computer to shut down fully?

1 answer

2


Try it this way:

WinExec(PAnsiChar('cmd.exe /c shutdown -s -t 10'), sw_normal);
  • 1

    It worked perfectly, thank you very much.

  • 1

    This @Denied is really mad. Thank you!

Browser other questions tagged

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