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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API To Shutdown Windows 2

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
I know I have seen this before, but I am looking for an API call to shutdown Windows. Search does not appear to be working at the moment, so apologies if this is covered elsewhere.

Ideally I want the one with an optional countdown facilty (an integral part of the API I have already seen that does this).

Any helpers can have a copy of the utility I am creating (as a thank you). Just post your email if you want it.

Oh, and info on any known problems in the different Windows versions would be handy too. :eek:)

Ed Metcalfe.
 
Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal

I found this in WIN32API.TXT from Microsoft Visual Studio.

Jamie
 
Public Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long

Sorry, my message got cut off.
 
Thanks very much. Just what I was looking for. Have a purple star.

Do you want a copy of the utility?

Ed Metcalfe. Please do not feed the trolls.....
 
Apart from the InitialSystemShutdown API function,you have ExitWindowEx function. Using this function in Windows 95/98/Me it is easy to shutdown. But in WindowsNT/2000 you need to have the necessary privileges to shutdown the machine! I have seen code in VB that does this. If I remember correct, the site is
 
Just cruisin' through the posts, and saw your link, lamrin... if I'd had this a couple of days ago, it would have saved me SOOO much time! Have a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top