- #include <windows.h>
- #include <Powrprof.h>
-
- #pragma comment(lib, "Powrprof.lib")
-
- int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR lpCmdLine, int nShowCmd)
- {
- UINT uiID = 0;
- POWER_POLICY PwrPolicy;
-
- GetActivePwrScheme(&uiID);
- ReadPwrScheme(uiID, &PwrPolicy);
-
- PwrPolicy.user.VideoTimeoutAc = 0;
- PwrPolicy.user.VideoTimeoutDc = 0;
-
- WritePwrScheme(&uiID, NULL, NULL, &PwrPolicy);
- SetActivePwrScheme(uiID, NULL, &PwrPolicy);
-
- return 1;
- }
http://blog.csdn.net/zwfgdlc/article/details/5696711