Why does GetDeviceGammaRamp always return false

z l 20 Reputation points
2023-07-11T10:09:06.6566667+00:00

I want to get the gamma value of the monitor, my code is below, but bget keeps FALSE, how can I tell where the problem is?

WORD gArray[3][256]; 	HDC hdc = GetDC(NULL); // 得到屏幕DC   	
int client_width = GetDeviceCaps(hdc, HORZRES); // 宽   	
BOOL bget = GetDeviceGammaRamp(hdc, gArray);   // 得到当前Gamma  	
ReleaseDC(NULL, hdc); // 释放DC
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,705 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 86,491 Reputation points
    2023-07-11T11:52:10.3066667+00:00

    I want to get the gamma value of the monitor

    You can use GetVCPFeatureAndVCPFeatureReply with VCP code = 0x72 for Gamma (details : https://milek7.pl/ddcbacklight/mccs.pdf)

    (works on my monitor, Philips 247ELH)

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.