I am trying to do something that seems simple enough, I just want my program to be able to adjust the brightness of the monitor under certain conditions. So, I looked into the windows of the Power Management API and found some things that seemed to work for me. The core of the code I compiled (basically, I referenced this ) is as follows:
GUID *pPwrGUID;
GUID subGUID = GUID_VIDEO_SUBGROUP;
GUID BriGUID = GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS;
PowerGetActiveScheme(NULL, &pPwrGUID);
PowerWriteACValueIndex(NULL, pPwrGUID, &subGUID, &BriGUID, 0);
Which seems simple enough. The problem I am facing is that PowerWriteACValueIndex returns error code 2: File not found, which does not make much sense to me. I thought the problem was that I had a bad index value (the last parameter in the PowerWriteACValueIndex function), but changing the read write using PowerReadACValueIndex (to see if I can get a legit value) also returns 2. I have already checked and made sure that GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS is in the GUID_VIDEO_SUBGROUP file in the header file.
Only other information that I can come up with can be useful is that my WINVER is set to 0x0600 (vista).
Any ideas what might be wrong here? It seems like this should be a fairly simple process, but I was out of luck. Thank.