From: Trevor on
Is there a documented way to set the backlight level while on external
power?

I wrote the following code for Windows Mobile 5, and it succeeded at setting
the backlight to medium. On Windows Mobile 6, it appears as if they
increased the range to 90. Setting the backlight to '3' on Windows Mobile 6
ends up setting the backlight to very low (3/90) while it would set the
backlight to medium on Windows Mobile 5 (3/5).

if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("ControlPanel\\BackLight"),
0, 0, &hKey) == ERROR_SUCCESS)
{
dwValue = 3; // 1-5, 5 = highest, 1 = lowest.
RegSetValueEx(hKey, _T("ACBrightness"), 0, REG_DWORD,
(CONST BYTE*)&dwValue, sizeof(DWORD));
RegSetValueEx(hKey, _T("BattBrightness"), 0, REG_DWORD,
(CONST BYTE*)&dwValue, sizeof(DWORD));
RegCloseKey(hKey);
}

Is there a documented way to do this? I know I can add a #ifdef (_WIN32_WCE
> 0x501) and set dwValue to 45 to achieve the same results for Windows
Mobile 6, but a documented way to do this would be preferred so I don't have
to change it every time Microsoft decides to change their implementation.

From: Bruce Jackson on
The range for backlight from minimum to maximum is different for most
devices.
0-10 is the default that works on many devices, iPAQ is usually from
1-5, some newer device use from 0-255, and there are others with 0-127
or 0-100

Also the registry key can have different names - "Brightness",
"BattBrightness", "BattBacklightLevel", "LuminanceLevel" just to name
a few

After changing the registry key you normally then need to trigger an
event -

HANDLE hBackLightEvent = CreateEvent(NULL, FALSE, TRUE, TEXT
("BacklightChangeEvent"));
if (hBackLightEvent)
{
SetEvent(hBackLightEvent);
CloseHandle(hBackLightEvent);
}


cheers
Bruce

On 17 Sep., 23:19, "Trevor" <tre...(a)nope.com> wrote:
> Is there a documented way to set the backlight level while on external
> power?
>
> I wrote the following code for Windows Mobile 5, and it succeeded at setting
> the backlight to medium.  On Windows Mobile 6, it appears as if they
> increased the range to 90.  Setting the backlight to '3' on Windows Mobile 6
> ends up setting the backlight to very low (3/90) while it would set the
> backlight to medium on Windows Mobile 5 (3/5).
>
>  if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("ControlPanel\\BackLight"),
>   0, 0, &hKey) == ERROR_SUCCESS)
>  {
>   dwValue = 3; // 1-5, 5 = highest, 1 = lowest.
>   RegSetValueEx(hKey, _T("ACBrightness"), 0, REG_DWORD,
>    (CONST BYTE*)&dwValue, sizeof(DWORD));
>   RegSetValueEx(hKey, _T("BattBrightness"), 0, REG_DWORD,
>    (CONST BYTE*)&dwValue, sizeof(DWORD));
>   RegCloseKey(hKey);
>  }
>
> Is there a documented way to do this?  I know I can add a #ifdef (_WIN32_WCE
>  > 0x501) and set dwValue to 45 to achieve the same results for Windows
> Mobile 6, but a documented way to do this would be preferred so I don't have
> to change it every time Microsoft decides to change their implementation.