API - abrir dialogo para desligar o windows |
Top Previous Next |
|
uses ShellAPI;
procedure APIDesligarDialog; type SHShutDownDialogProc = procedure(wnd: HWND); stdcall; var SHShutDownDialog: SHShutDownDialogProc; ShellHandle : THandle; begin ShellHandle := Windows.LoadLibrary(PChar(shell32)); if ShellHandle <> 0 then begin SHShutDownDialog := GetProcAddress(ShellHandle, PChar(60)); SHShutDownDialog(Application.Handle); end else ShowMessage('Função não suportada por esta versão do Windows'); end;
procedure TForm1.Button1Click(Sender: TObject); begin APIDesligarDialog; end; |