Reduce "BACKLIGHT" brightness in windows Embedded standard 7 using vc++

439 views Asked by At

Is it possible to reduce the "Backlight brightness" in Windows Embedded standard 7, Monitor:Samsung DE40A programmatically with vc++ ? It is possible to reduce monitor backlight brightness with the monitor's remote.

I have been able to reduce brightness,contrast,gamma, and RGB values with the respective APIs SetMonitorBrightness, SetMonitorContrast, etc. Tried to use DeviceIoControl function with IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS but the function call doesn't succeed, it gives a non-zero value and according to msdn the function has failed.

//Get the handle
HANDLE hLCD = CreateFile("\\\\.\\LCD",       // open LCD device
                         GENERIC_READ,                  // access to the drive
                         FILE_SHARE_READ|FILE_SHARE_WRITE,// share mode
                         NULL,                          // default security attributes
                         OPEN_EXISTING,                 // disposition
                         0,                             // file attributes
                         NULL);

if (hLCD == INVALID_HANDLE_VALUE)
{
    cout << "error: Invalid Handle, unable to get LCD handle" << GetLastError() << endl;
    return 1;
}

BYTE SupportedBrightness[256];
DWORD nBytesReturned;

int nRes = DeviceIoControl(
               (HANDLE) hLCD,                           // handle to device
               IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS,  // dwIoControlCode
               NULL,                                    // lpInBuffer
               0,                                       // nInBufferSize
               (LPVOID) SupportedBrightness,            // output buffer
               sizeof(SupportedBrightness),             // size of output buffer
               (LPDWORD) &nBytesReturned,               // bytes returned
               NULL                                     // OVERLAPPED
           );

if (nRes == 0)
{
    cout << "error: Backlight Not Supported" << GetLastError() << endl;
    return 2;
}

cout << "Supported levels:: ";
for (DWORD i=0; i<nBytesReturned; i++)
{
    cout << (DWORD)SupportedBrightness[i] << ", ";
}
cout << endl << endl;

I end up getting "Backlight not supported", but I can change back light brightness from Samsung Monitor's remote.

0

There are 0 answers