pbsmbc
asked on
Reboot from MFC application
Hi,
Is there any function in MFC that will reboot(soft) the work station while exiting from a MFC application.
The requirement is if the user press a button it will exit the application and it will reboot the
computer also. If it's possible is any source code available?
I am using VC++ 6.
Thanks
Is there any function in MFC that will reboot(soft) the work station while exiting from a MFC application.
The requirement is if the user press a button it will exit the application and it will reboot the
computer also. If it's possible is any source code available?
I am using VC++ 6.
Thanks
ASKER
Does the user (who is using the application) need to have administrative privilage to reboot?
Yes, please take a look at this link from MSDN for some sample code.
http://msdn2.microsoft.com/en-us/library/aa376871.aspx
http://msdn2.microsoft.com/en-us/library/aa376871.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry for answering Yes to your "is administrative privileges required " question. jkr above is right and that's what the link i qouted with the comment indicates as well.
ASKER
Thanks jkr.
What is the difference between InitiateSystemShutdown and exitwindowex?
What is the difference between InitiateSystemShutdown and exitwindowex?
Both will have the same effect, yet 'InitiateSystemShutdown()' is the more NT-like solution that is safe to follow up the path over XP to it's successors.
ASKER
Our application is running on both XP and NT.
So is InitiateSystemShutdown better choice?
So is InitiateSystemShutdown better choice?
{
//save all your work
ExitWindowsEx(EWX_REBOOT, 0) ;
}