I want to call for dialog box "shutdown windows".
I was using ExitwindowsEx, but didn't function.
I am using Vc++. in windows 9x, with a program of the type "win32 console Application".
"ExitwindowsEX(EWX_SHUTDOWN| EWX_FORCE,0)" didn't run correctly. it only closed all programas, but it
don't shutdown my computer(turn - off). I am using Win95, and VC++. My program is "Win32 console Application".
I try with program of the type "Win32 Application", it closed all program and show the message "wait
windows is shutDown........", but it show the message FOREVER.
what is it wrong?
ShutdownSystem(EWX_SHUTDOWN | EWX_FORCE);
BOOL ShutdownSystem(unsigned int uFlags)
const char szShutdown = "SeShutdownPrivilege";
if(OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken) )
tkp.PrivilegeCount = 1;
tkp.Privileges.Attributes = SE_PRIVILEGE_ENABLED;
bOkShutdown = (AdjustTokenPrivileges(hToken,0,&tkp,0,(PTOKEN_PRIVILEGES)NULL,0)!=0);
fResult = ExitWindowsEx(uFlags,0);