Startup computer automatically
-
Is there any way to boot up a computer automatically at a specific time from a program, ie run the program, call a function (???) and then switch off the computer, and then the computer would start up automatically at the specified time. If not then is there some way of bringing the computer out of hibernation in a similar way??? Thanks
-
Is there any way to boot up a computer automatically at a specific time from a program, ie run the program, call a function (???) and then switch off the computer, and then the computer would start up automatically at the specified time. If not then is there some way of bringing the computer out of hibernation in a similar way??? Thanks
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) { if (IsWindowsNT()) { // Windows NT etc HANDLE hToken; TOKEN_PRIVILEGES tkp; // Reset last error SetLastError(ERROR_SUCCESS); // Get a token for this process. if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return FALSE; // Get the LUID for the 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 the shutdown privilege for this process. AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); // Cannot test the return value of AdjustTokenPrivileges. if (GetLastError() != ERROR_SUCCESS) return FALSE; // Shut down the system and force all applications to close. if (!ExitWindowsEx(flags | EWX_FORCE, 0)) return FALSE; return TRUE; } else { // Windows 95 etc if (!ExitWindowsEx(flags, 0)) return FALSE; return TRUE; } }
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. -
Is there any way to boot up a computer automatically at a specific time from a program, ie run the program, call a function (???) and then switch off the computer, and then the computer would start up automatically at the specified time. If not then is there some way of bringing the computer out of hibernation in a similar way??? Thanks
personally, I think you need a external device & program to control the power supply of shut down pc.
-
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) { if (IsWindowsNT()) { // Windows NT etc HANDLE hToken; TOKEN_PRIVILEGES tkp; // Reset last error SetLastError(ERROR_SUCCESS); // Get a token for this process. if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return FALSE; // Get the LUID for the 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 the shutdown privilege for this process. AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); // Cannot test the return value of AdjustTokenPrivileges. if (GetLastError() != ERROR_SUCCESS) return FALSE; // Shut down the system and force all applications to close. if (!ExitWindowsEx(flags | EWX_FORCE, 0)) return FALSE; return TRUE; } else { // Windows 95 etc if (!ExitWindowsEx(flags, 0)) return FALSE; return TRUE; } }
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.I actually meant is there any way to turn the computer on automatically at a specific time, when it has been turned off manually. For example could I program the computer to boot up at 8 o'clock every morning? If not, is there any way to bring the computer out of standby mode in the same way, ie bring the computer out of standby at 8 o'clock every morning. Thanks
-
I actually meant is there any way to turn the computer on automatically at a specific time, when it has been turned off manually. For example could I program the computer to boot up at 8 o'clock every morning? If not, is there any way to bring the computer out of standby mode in the same way, ie bring the computer out of standby at 8 o'clock every morning. Thanks
Hain i think you are seaching for wake on Lan feature type application. i am able to boot computer through network at giving time. bascially it functioning is like this-> You send a packet containg the subnet mask of you network to that particular computer which is in off state this feature only feasible for ATX cabinet computer & lan card with wake on lan feature Happy programming ----------------------------- "I Think It will Work" Formerly Known As "Alok The Programmer" at CP ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk
-
Is there any way to boot up a computer automatically at a specific time from a program, ie run the program, call a function (???) and then switch off the computer, and then the computer would start up automatically at the specified time. If not then is there some way of bringing the computer out of hibernation in a similar way??? Thanks