하드디스크 절전 모드 전환 시간 설정하기 DarkKaiser, 2011년 1월 4일2023년 9월 5일 void TestFunc() { MYGetActivePwrScheme pFunc1 = NULL; MYGetCurrentPowerPolicies pFunc2 = NULL; MYSetActivePwrScheme pFunc3 = NULL; HINSTANCE hInstance = NULL; hInstance = LoadLibrary( "powrprof" ); if( hInstance ) { pFunc1 = (MYGetActivePwrScheme)GetProcAddress( hInstance, "GetActivePwrScheme" ); if( pFunc1 == NULL ) { TRACE("GetActivePwrScheme Fail"); ERROR_ROUTINE( hInstance ); } pFunc2 = (MYGetCurrentPowerPolicies)GetProcAddress( hInstance, "GetCurrentPowerPolicies" ); if( pFunc2 == NULL ) { TRACE("GetCurrentPowerPolicies Fail"); ERROR_ROUTINE( hInstance ); } pFunc3 = (MYSetActivePwrScheme)GetProcAddress( hInstance, "SetActivePwrScheme" ); if( pFunc3 == NULL ) { TRACE("SetActivePwrScheme Fail"); ERROR_ROUTINE( hInstance ); } UINT uiActivePwrSchIndex; GLOBAL_POWER_POLICY stGlobalPwrPly; POWER_POLICY stPwrPly; if( ((pFunc1)( &uiActivePwrSchIndex )) == 0 ) { TRACE("Call GetActivePwrScheme Error"); ERROR_ROUTINE( hInstance ); } if( ((pFunc2)( &stGlobalPwrPly, &stPwrPly )) == 0 ) { TRACE("Call GetCurrentPowerPolicies Error"); ERROR_ROUTINE( hInstance ); } // Set SpinDown Timeout value (하드디스크 절전 모드 전환 시간, 단위 초) stPwrPly.user.SpindownTimeoutAc = 600; // Set Idle Timeout value (시스템 대기 모드 해제) // stPwrPly.user.IdleTimeoutAc = 0; if( ((pFunc3)( uiActivePwrSchIndex, &stGlobalPwrPly, &stPwrPly )) == 0 ) { TRACE("Call SetActivePwrScheme Error"); ERROR_ROUTINE( hInstance ); } TRACE("SUCCESS"); FreeLibrary( hInstance ); hInstance = NULL; } else { TRACE("Load library error"); } } C/C++/VC++