Click to See Complete Forum and Search --> : How to call shutdown from within Visual C++?


sureshmv8
September 9th, 1999, 12:50 PM
I have a program in which I want to provide shutdown facility so that the user can shutdown the computer from my program without going to the start menu. How to perform this task? Can anybody help!!!!

m.v. suresh

Anthony Mai
September 9th, 1999, 01:56 PM
You should learn to find answers to your question by using the VisualStudio help.

In Visual Studio 6.0, goto menu help->search..
In the MSDN search dialogbox, click on the "Contents" tab. Go to
-->Platform SDK->Reference->Win32 functions by category->System shut down functions. And there you can find all you need to shut down the system.


I hate fat programs as much as I hate being fat myself. I am lean and mean and so is my program.

SteveH
September 9th, 1999, 05:05 PM
Use this function ExitWindowsEx

pr_101
September 9th, 1999, 05:15 PM
What parametes are need in that function(ExitWindowsEx)? How do I use it in my code?

sureshmv8
September 10th, 1999, 11:55 AM
Thanx steve, Your suggestion has solved my problem.

m.v. suresh

Waqas Ahmed
September 10th, 1999, 11:43 PM
Call the windows API ExitWindows or ExitWindowEx for shutting down windows.
A sample is
[ccode]
::ExitWindowsEx(EWX_LOGOFF,0) will logoff the computer;.
::ExitWindowsEx(EWX_SHUTDOWN,0) will shutdown the computer.
See the MSDN for more details about the ExitWindows and ExitWindowsEx.