Hi,
Does anyone know how i can shut down my computer wiht a VC++ comand?
thankx
Hi,
Does anyone know how i can shut down my computer wiht a VC++ comand?
thankx
ExitWindowsEx(EWX_SHUTDOWN, 0) should be adequate, but check MSDN for more parameter options.
"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C
thank you, it works for win9x but not for winXP... does anyone know why?
When attempting to shutdown or restart a system with Windows XP, you must first call the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.
Check out: AdjustTokenPrivileges()
It will give you information on the function and how to use it in order to do this. Once you have access to shutdown the system, you can call ExitWindowsEx in order to shut the system down now.