title: Using Windows Power Management API to dim monitor
body: <p>I'm trying to do something that seems simple enough, I just want to have my program able to adjust the monitor brightness under certain conditions. So, I looked into the windows <a href="http://msdn.microsoft.com/en-us/library/aa373163%28v=vs.85%29.aspx" rel="noreferrer">Power Management API</a> and found some things that seemed like they would work for me. The core of the code I put together (basically, I referenced <a href="http://social.msdn.microsoft.com/Forums/en/tabletandtouch/thread/1e0f9f50-6d03-47f7-b801-5a16d97cbb77" rel="noreferrer">this</a>) looks like this:</p>
  
  <pre><code>GUID *pPwrGUID;
  GUID subGUID = GUID_VIDEO_SUBGROUP;
  GUID BriGUID = GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS;
  
  PowerGetActiveScheme(NULL, &amp;pPwrGUID);
  PowerWriteACValueIndex(NULL, pPwrGUID, &amp;subGUID, &amp;BriGUID, 0);
  </code></pre>
  
  <p>Which seems simple enough. The problem I'm having is that PowerWriteACValueIndex returns error code 2: File Not Found, which isn't making a lot of sense to me. I was thinking that the problem was just that I had a bad Index value (last param in the PowerWriteACValueIndex function), but changing the write to a read with PowerReadACValueIndex (to see if I could get a legitimate value) also returns a 2. I already checked and made sure that GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS is under GUID_VIDEO_SUBGROUP in the header file.</p>
  
  <p>Only other info I can think of that may be helpful is that my WINVER is set to 0x0600 (vista).</p>
  
  <p>Any ideas what could be going wrong here? It seems like it should be a pretty straightforward process but I'm not really having any luck. Thank you.</p>