Click here to Skip to main content
15,922,315 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: shut down the pc when finish... Pin
Hamid_RT7-Feb-07 0:15
Hamid_RT7-Feb-07 0:15 
AnswerRe: shut down the pc when finish... Pin
Don Box6-Feb-07 23:28
Don Box6-Feb-07 23:28 
GeneralRe: shut down the pc when finish... Pin
Ing.Raiz826-Feb-07 23:38
Ing.Raiz826-Feb-07 23:38 
GeneralRe: shut down the pc when finish... Pin
Hamid_RT7-Feb-07 0:19
Hamid_RT7-Feb-07 0:19 
AnswerRe: shut down the pc when finish... Pin
Hamid_RT7-Feb-07 0:17
Hamid_RT7-Feb-07 0:17 
AnswerRe: shut down the pc when finish... Pin
Ing.Raiz827-Feb-07 0:28
Ing.Raiz827-Feb-07 0:28 
GeneralRe: shut down the pc when finish... Pin
Hamid_RT7-Feb-07 0:31
Hamid_RT7-Feb-07 0:31 
AnswerRe: shut down the pc when finish... Pin
Ing.Raiz827-Feb-07 1:00
Ing.Raiz827-Feb-07 1:00 
ok....

This is the code... it work....Smile | :)

//giulio shutdown pc

HANDLE hToken;
TOKEN_PRIVILEGES tkp;

if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
{
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if(AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0))
{
ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF|EWX_FORCE,0);
}
}



Smile | :) Smile | :) Smile | :) Smile | :) Smile | :) Smile | :) Smile | :) Smile | :)

Bye

Giulio
AnswerRe: shut down the pc when finish... Pin
Sumesh V.V8-Feb-07 18:34
Sumesh V.V8-Feb-07 18:34 
QuestionStatusBar Properties Pin
T.RATHA KRISHNAN6-Feb-07 22:49
T.RATHA KRISHNAN6-Feb-07 22:49 
AnswerRe: StatusBar Properties Pin
Iain Clarke, Warrior Programmer7-Feb-07 0:28
Iain Clarke, Warrior Programmer7-Feb-07 0:28 
AnswerRe: StatusBar Properties Pin
David Crow7-Feb-07 2:50
David Crow7-Feb-07 2:50 
QuestionMFC Drag and drop Pin
sikora6-Feb-07 22:49
sikora6-Feb-07 22:49 
AnswerRe: MFC Drag and drop Pin
Don Box6-Feb-07 23:13
Don Box6-Feb-07 23:13 
GeneralRe: MFC Drag and drop Pin
sikora6-Feb-07 23:28
sikora6-Feb-07 23:28 
AnswerRe: MFC Drag and drop Pin
Hamid_RT7-Feb-07 0:36
Hamid_RT7-Feb-07 0:36 
QuestionRe: MFC Drag and drop Pin
David Crow7-Feb-07 2:56
David Crow7-Feb-07 2:56 
Questionmove 2 or more element for time in list Pin
Ing.Raiz826-Feb-07 22:47
Ing.Raiz826-Feb-07 22:47 
AnswerRe: move 2 or more element for time in list Pin
David Crow7-Feb-07 2:58
David Crow7-Feb-07 2:58 
NewsRe: move 2 or more element for time in list Pin
Ing.Raiz827-Feb-07 3:32
Ing.Raiz827-Feb-07 3:32 
GeneralRe: move 2 or more element for time in list Pin
David Crow7-Feb-07 4:59
David Crow7-Feb-07 4:59 
QuestionWhat is the difference between __cdecl and __stdcall Pin
Kotesh.N6-Feb-07 22:34
Kotesh.N6-Feb-07 22:34 
AnswerRe: What is the difference between __cdecl and __stdcall Pin
Michael Dunn6-Feb-07 22:38
sitebuilderMichael Dunn6-Feb-07 22:38 
AnswerRe: What is the difference between __cdecl and __stdcall Pin
Eytukan6-Feb-07 23:37
Eytukan6-Feb-07 23:37 
QuestionTo change IIS Timeout in MS C++ Pin
Mushtaque Nizamani6-Feb-07 22:20
Mushtaque Nizamani6-Feb-07 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.