I am developing a 64 bit console application using Visual studio on a Windows 10 computer, using the Windows SDK version 10.0.17134.0
I am trying to get the monitor brightness values using the the GetMonitorBrightness API. The code for the same is as follows:
HWND hwnd = GetForegroundWindow();
HMONITOR hmonitor;
hmonitor = MonitorFromWindow(GetForegroundWindow(), MONITOR_DEFAULTTOPRIMARY);
DWORD min, curr, max;
if (GetMonitorBrightness(hmonitor,&min,&curr,&max))
{
cout << ": The error code is " << GetLastError() << endl;
}
cout << ": The error code is " << GetLastError() << endl;
getchar();
return 0;
I am getting the following error: LNK2019 unresolved external symbol GetMonitorBrightness referenced in function main
I have also included the correct header file i.e., highlevelmonitorconfigurationapi.h.
And my monitors are DDC/CI enabled too.
Any idea how I can fix the error for the above mentioned API?