Click here to Skip to main content
15,914,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionread/write buffered render engine... suggestions? Pin
xdissent2-Sep-04 12:38
xdissent2-Sep-04 12:38 
Generalcustom error during compile time Pin
Rohit Joshi2-Sep-04 11:32
Rohit Joshi2-Sep-04 11:32 
GeneralRe: custom error during compile time Pin
Michael Dunn2-Sep-04 12:01
sitebuilderMichael Dunn2-Sep-04 12:01 
GeneralRe: custom error during compile time Pin
James R. Twine2-Sep-04 13:53
James R. Twine2-Sep-04 13:53 
GeneralNT User ID Using Visual C++ Pin
canniballl2-Sep-04 11:12
canniballl2-Sep-04 11:12 
GeneralRe: NT User ID Using Visual C++ Pin
Joaquín M López Muñoz2-Sep-04 11:29
Joaquín M López Muñoz2-Sep-04 11:29 
GeneralStartup computer automatically Pin
sschilachi2-Sep-04 11:03
sschilachi2-Sep-04 11:03 
GeneralRe: Startup computer automatically Pin
Mika Larramo2-Sep-04 12:20
Mika Larramo2-Sep-04 12:20 
I'm not sure what you mean, but if you mean to restart a computer at specified time it is possible of course. Below you have a function for rebooting the computer. It works with all Windows versions. Call it with the in parameter EWX_REBOOT and the system will be rebooted:

BOOL WindowsExitOrReboot(UINT flags)<br />
{<br />
	if (IsWindowsNT()) { // Windows NT etc<br />
		HANDLE hToken; <br />
		TOKEN_PRIVILEGES tkp; <br />
<br />
		// Reset last error<br />
		SetLastError(ERROR_SUCCESS);<br />
 		// Get a token for this process. <br />
		if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) <br />
			return FALSE;<br />
<br />
		// Get the LUID for the shutdown privilege. <br />
		LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); <br />
 		tkp.PrivilegeCount = 1;  // one privilege to set    <br />
		tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; <br />
<br />
		// Get the shutdown privilege for this process. <br />
		AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); <br />
 		// Cannot test the return value of AdjustTokenPrivileges. <br />
		if (GetLastError() != ERROR_SUCCESS) return FALSE;<br />
 <br />
		// Shut down the system and force all applications to close. <br />
		if (!ExitWindowsEx(flags | EWX_FORCE, 0)) return FALSE;<br />
		return TRUE;<br />
	}<br />
	else { // Windows 95 etc<br />
		if (!ExitWindowsEx(flags, 0)) return FALSE;<br />
		return TRUE;<br />
	}<br />
}


But if you mean to shut down the computer for a time and then let it start automatically I don't think it is possible. Not without some hardware.
GeneralRe: Startup computer automatically Pin
sschilachi2-Sep-04 21:01
sschilachi2-Sep-04 21:01 
GeneralRe: Startup computer automatically Pin
ThatsAlok3-Sep-04 4:19
ThatsAlok3-Sep-04 4:19 
GeneralRe: Startup computer automatically Pin
lonely_life2-Sep-04 16:27
lonely_life2-Sep-04 16:27 
GeneralRe: Startup computer automatically Pin
bmw50025-Sep-04 14:45
bmw50025-Sep-04 14:45 
Questiondundas vs. roguewave vs. ??? Pin
Maximilien2-Sep-04 10:30
Maximilien2-Sep-04 10:30 
AnswerRe: dundas vs. roguewave vs. ??? Pin
Antony M Kancidrowski3-Sep-04 2:27
Antony M Kancidrowski3-Sep-04 2:27 
GeneralRandom Number Generator Pin
Alexander M.,2-Sep-04 9:30
Alexander M.,2-Sep-04 9:30 
GeneralRe: Random Number Generator Pin
David Crow2-Sep-04 9:33
David Crow2-Sep-04 9:33 
GeneralRe: Random Number Generator Pin
Alexander M.,2-Sep-04 9:57
Alexander M.,2-Sep-04 9:57 
GeneralRe: Random Number Generator Pin
David Crow2-Sep-04 10:01
David Crow2-Sep-04 10:01 
GeneralRe: Random Number Generator Pin
Alexander M.,2-Sep-04 10:36
Alexander M.,2-Sep-04 10:36 
GeneralRe: Random Number Generator Pin
User 66582-Sep-04 10:17
User 66582-Sep-04 10:17 
GeneralRe: Random Number Generator Pin
PJ Arends2-Sep-04 12:43
professionalPJ Arends2-Sep-04 12:43 
GeneralRe: Random Number Generator Pin
alex.barylski2-Sep-04 18:39
alex.barylski2-Sep-04 18:39 
GeneralRe: Random Number Generator Pin
Antony M Kancidrowski3-Sep-04 2:30
Antony M Kancidrowski3-Sep-04 2:30 
GeneralRe: Random Number Generator Pin
Henry miller3-Sep-04 3:25
Henry miller3-Sep-04 3:25 
Generalerror copying files on Windows 2003 Pin
lkbotica2-Sep-04 8:42
lkbotica2-Sep-04 8:42 

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.