Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to shutdown windows in Delphi 7?

Status
Not open for further replies.

Spent

Programmer
Mar 20, 2003
100
BG
Hi I want to make a procedure that shutdowns the PC. How to do it?
Thanks

Spent
mail:teknet@mail.orbitel.bg
 
Well if you call (with executefile for example)
'C:\windows\rundll.exe' with parameters 'user.exit.exitwindows' that will shutdown a windows 98 system. there may be a more universal and neater way though using an API Call or a regisry hack.
I would need to look at the docs.



Steve:
A Delphi Programmer
A Feersum Endjinn indeed
 
The following code will bring up the shutdown dialog box:


procedure TForm1.Button1Click(Sender: TObject);
var
shell: Variant;
begin
shell := CreateOleObject('Shell.Application');
shell.ShutdownWindows;
end;


Remember to also add 'StdCtrls' and 'ComObj' to your uses.


British.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top