ฉันมี Dell U2515H เชื่อมต่อผ่าน HDMI เข้ากับการ์ด nVidia
ฉันลองsoftMCCSและใช้งานได้ดี ฉันสามารถปรับความสว่างของแสงไฟจากซอฟต์แวร์
นี่คือรหัสควบคุมที่จอภาพนี้สนับสนุนอย่างเห็นได้ชัด:
New control value
Restore factory defaults
Restore luminance/contrast defaults
Restore color defaults
Luminance
Contrast
Select color preset
Red video gain
Green video gain
Blue video gain
Active control
Input source
Screen orientation
Horizontal frequency
Vertical frequency
Panel sub-pixel layout
Display technology type
Application enable key
Display controller type
Display firmware level
Power mode
Display application
VCP version
Manufacturer specific - 0xE0
Manufacturer specific - 0xE1
Manufacturer specific - 0xE2
Manufacturer specific - 0xF0
Manufacturer specific - 0xF1
Manufacturer specific - 0xF2
Manufacturer specific - 0xFD
ฉันได้ประเมินเครื่องมืออื่น ๆ ด้วย:
- หรี่แสง - ไม่หรี่แสงพื้นหลัง ใช้ซอฟต์แวร์ปลอมลดแสง
- ScreenBright - เห็นได้ชัดว่าใช้ DDC / CI เพื่อควบคุมแสงไฟ แต่ถูกลบออกจากเว็บไซต์ของผู้เขียน ฉันยังไม่ได้ลองดาวน์โหลดมันจากหนึ่งในเว็บไซต์หลบกระจกเหล่านั้น
- Redshift - ทำตัวเหมือน Dimmer
แก้ไข: ปรากฎว่ามี API ที่ใช้งานง่ายสำหรับการตั้งค่าความสว่างหน้าจอใน Windows นี่คือตัวอย่างรหัส:
Monitor.h
#pragma once
#include <physicalmonitorenumerationapi.h>
#include <highlevelmonitorconfigurationapi.h>
#include <vector>
class Monitor
{
public:
explicit Monitor(PHYSICAL_MONITOR pm);
~Monitor();
bool brightnessSupported() const;
int minimumBrightness() const;
int maximumBrightness() const;
int currentBrightness() const;
void setCurrentBrightness(int b);
// Set brightness from 0.0-1.0
void setCurrentBrightnessFraction(double fraction);
private:
bool mBrightnessSupported = false;
int mMinimumBrightness = 0;
int mMaximumBrightness = 0;
int mCurrentBrightness = 0;
PHYSICAL_MONITOR mPhysicalMonitor;
};
std::vector<Monitor> EnumerateMonitors();
Monitor.cpp
#include "stdafx.h"
#include "Monitor.h"
Monitor::Monitor(PHYSICAL_MONITOR pm) : mPhysicalMonitor(pm)
{
DWORD dwMonitorCapabilities = 0;
DWORD dwSupportedColorTemperatures = 0;
BOOL bSuccess = GetMonitorCapabilities(mPhysicalMonitor.hPhysicalMonitor, &dwMonitorCapabilities, &dwSupportedColorTemperatures);
if (bSuccess)
{
if (dwMonitorCapabilities & MC_CAPS_BRIGHTNESS)
{
// Get min and max brightness.
DWORD dwMinimumBrightness = 0;
DWORD dwMaximumBrightness = 0;
DWORD dwCurrentBrightness = 0;
bSuccess = GetMonitorBrightness(mPhysicalMonitor.hPhysicalMonitor, &dwMinimumBrightness, &dwCurrentBrightness, &dwMaximumBrightness);
if (bSuccess)
{
mBrightnessSupported = true;
mMinimumBrightness = dwMinimumBrightness;
mMaximumBrightness = dwMaximumBrightness;
}
}
}
}
Monitor::~Monitor()
{
}
bool Monitor::brightnessSupported() const
{
return mBrightnessSupported;
}
int Monitor::minimumBrightness() const
{
return mMinimumBrightness;
}
int Monitor::maximumBrightness() const
{
return mMaximumBrightness;
}
int Monitor::currentBrightness() const
{
if (!mBrightnessSupported)
return -1;
DWORD dwMinimumBrightness = 0;
DWORD dwMaximumBrightness = 100;
DWORD dwCurrentBrightness = 0;
BOOL bSuccess = GetMonitorBrightness(mPhysicalMonitor.hPhysicalMonitor, &dwMinimumBrightness, &dwCurrentBrightness, &dwMaximumBrightness);
if (bSuccess)
{
return dwCurrentBrightness;
}
return -1;
}
void Monitor::setCurrentBrightness(int b)
{
if (!mBrightnessSupported)
return;
SetMonitorBrightness(mPhysicalMonitor.hPhysicalMonitor, b);
}
void Monitor::setCurrentBrightnessFraction(double fraction)
{
if (!mBrightnessSupported)
return;
if (mMinimumBrightness >= mMaximumBrightness)
return;
setCurrentBrightness((mMaximumBrightness - mMinimumBrightness) * fraction + mMinimumBrightness);
}
BOOL CALLBACK MonitorEnumCallback(_In_ HMONITOR hMonitor, _In_ HDC hdcMonitor, _In_ LPRECT lprcMonitor, _In_ LPARAM dwData)
{
std::vector<Monitor>* monitors = reinterpret_cast<std::vector<Monitor>*>(dwData);
// Get the number of physical monitors.
DWORD cPhysicalMonitors;
BOOL bSuccess = GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, &cPhysicalMonitors);
LPPHYSICAL_MONITOR pPhysicalMonitors = NULL;
if (bSuccess)
{
// Allocate the array of PHYSICAL_MONITOR structures.
LPPHYSICAL_MONITOR pPhysicalMonitors = new PHYSICAL_MONITOR[cPhysicalMonitors];
if (pPhysicalMonitors != NULL)
{
// Get the array.
bSuccess = GetPhysicalMonitorsFromHMONITOR(hMonitor, cPhysicalMonitors, pPhysicalMonitors);
// Use the monitor handles.
for (unsigned int i = 0; i < cPhysicalMonitors; ++i)
{
monitors->push_back(Monitor(pPhysicalMonitors[i]));
}
}
}
// Return true to continue enumeration.
return TRUE;
}
std::vector<Monitor> EnumerateMonitors()
{
std::vector<Monitor> monitors;
EnumDisplayMonitors(NULL, NULL, MonitorEnumCallback, reinterpret_cast<LPARAM>(&monitors));
return monitors;
}
ใช้ในทางที่ชัดเจน