Click here to Skip to main content
15,919,178 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalreally really last question Pin
JabraJabra22-Jun-04 6:39
JabraJabra22-Jun-04 6:39 
GeneralRe: really really last question Pin
Cedric Moonen22-Jun-04 22:31
Cedric Moonen22-Jun-04 22:31 
General64-bit DLL Pin
Anonymous21-Jun-04 12:25
Anonymous21-Jun-04 12:25 
QuestionHow to restart a service every 3 hrs or reboot Windows every 3 hours Pin
sysmatrix21-Jun-04 11:02
sysmatrix21-Jun-04 11:02 
AnswerRe: How to restart a service every 3 hrs or reboot Windows every 3 hours Pin
palbano21-Jun-04 11:18
palbano21-Jun-04 11:18 
GeneralRe: How to restart a service every 3 hrs or reboot Windows every 3 hours Pin
sysmatrix21-Jun-04 11:42
sysmatrix21-Jun-04 11:42 
GeneralRe: How to restart a service every 3 hrs or reboot Windows every 3 hours Pin
palbano21-Jun-04 14:08
palbano21-Jun-04 14:08 
AnswerRe: How to restart a service every 3 hrs or reboot Windows every 3 hours Pin
ThatsAlok21-Jun-04 21:18
ThatsAlok21-Jun-04 21:18 
i don't want to method of retsrting service but i know the method of restrating machine.

you set WM_TIMER message of 5 min
eg
SetTimer(1,1000*300,NULL);//setimer for 5 min
and now make variable that increment after every WM_TIMER message
nCount++;//like this way
when timer equal to 35

use this code for restart
HANDLE hToken; // handle to process token
TOKEN_PRIVILEGES tkp; // pointer to token structure


OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) ;

// Get the LUID for shutdown privilege.

LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);

tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

// Get shutdown privilege for this process.

AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES) NULL, 0);

use
::InitiateSystemShutdown(NULL,ReturnStr,(DWORD)(atoi(this->m_nmpShutdown.Time)),TRUE,TRUE); this api's
thanksSmile | :)

I Think It will Work
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
AnswerRe: How to restart a service every 3 hrs or reboot Windows every 3 hours Pin
gamitech22-Jun-04 13:25
gamitech22-Jun-04 13:25 
GeneralWin32 Serial Communications Pin
rollei35guy21-Jun-04 9:56
rollei35guy21-Jun-04 9:56 
GeneralRe: Win32 Serial Communications Pin
Trollslayer21-Jun-04 12:36
mentorTrollslayer21-Jun-04 12:36 
GeneralRe: Win32 Serial Communications Pin
rollei35guy21-Jun-04 14:56
rollei35guy21-Jun-04 14:56 
GeneralRemoving title bar from CMiniDockFrameWnd Pin
Ed Deighton21-Jun-04 8:24
Ed Deighton21-Jun-04 8:24 
GeneralRe: Removing title bar from CMiniDockFrameWnd Pin
palbano21-Jun-04 9:05
palbano21-Jun-04 9:05 
GeneralBuilding a neural network Pin
pavanbabut21-Jun-04 8:22
pavanbabut21-Jun-04 8:22 
GeneralRe: Building a neural network Pin
palbano21-Jun-04 8:56
palbano21-Jun-04 8:56 
GeneralRe: Building a neural network Pin
pavanbabut21-Jun-04 9:27
pavanbabut21-Jun-04 9:27 
GeneralRe: Building a neural network Pin
palbano21-Jun-04 11:00
palbano21-Jun-04 11:00 
GeneralHelp me out Pin
pavanbabut21-Jun-04 8:05
pavanbabut21-Jun-04 8:05 
GeneralRe: Help me out Pin
valikac21-Jun-04 9:16
valikac21-Jun-04 9:16 
GeneralRe: Help me out Pin
pavanbabut21-Jun-04 10:37
pavanbabut21-Jun-04 10:37 
GeneralFinding My Window State Pin
G.O.21-Jun-04 7:50
G.O.21-Jun-04 7:50 
GeneralRe: Finding My Window State Pin
vcplusplus21-Jun-04 8:24
vcplusplus21-Jun-04 8:24 
GeneralRe: Finding My Window State Pin
G.O.21-Jun-04 10:32
G.O.21-Jun-04 10:32 
GeneralRe: Finding My Window State Pin
Ravi Bhavnani21-Jun-04 12:21
professionalRavi Bhavnani21-Jun-04 12:21 

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.