CallNtPowerInformation API fails with error code STATUS_INVALID_PARAMETER RRS feed

  • Question

  • I run the following code to get the video display timeout:

    SYSTEM_POWER_POLICY spp = {0};
    DWORD dwRes = CallNtPowerInformation(SystemPowerPolicyAc, NULL, 0, &spp, sizeof(spp));
    if(dwRes != STATUS_SUCCESS)
        //Error 0xC000000D or STATUS_INVALID_PARAMETER
        //An invalid parameter was passed to a service or function.
        int nTimeout = spp.VideoTimeout;

    It works on my Windows 7 but then on another laptop running Windows 7 as well it returns the error code STATUS_INVALID_PARAMETER. Does anyone have any idea why? And how to remedy it?
    • Moved by Jesse Jiang Wednesday, September 12, 2012 7:01 AM (From:Visual C++ General)
    Tuesday, September 11, 2012 1:17 AM

All replies