在vs2015 c ++ windows10中访问GetDC(NULL)时出错。错误:C3861'的GetDC'未找到标识符和标识符' GetDC'未定义。

时间:2016-08-26 06:52:15

标签: visual-studio-2015 windows-10 windows-rt

我需要一个winRt c ++组件,可以从JavaScript中调用,可以控制屏幕亮度。我无法调用函数GetDC(NULL),弹出错误。这是我的代码片段:

#include "pch.h"
#include "Class1.h" // The one which i created.
#include <windows.h>

....

BOOL Class1::SetBrightness(HDC hDC, WORD wBrightness)
{

BOOL bReturn = FALSE;
HDC hGammaDC = hDC;


if (hDC == NULL)
{

HDC hGammaDC = GetDC(NULL); //  Error 'GetDC' identifier not found.
}
if (hGammaDC != NULL)
{
WORD GammaArray[3][256];

for (int iIndex = 0; iIndex < 256; iIndex++)
{
int iArrayValue = iIndex * (wBrightness + 128);

if (iArrayValue > 65535)
iArrayValue = 65535;

GammaArray[0][iIndex] =
GammaArray[1][iIndex] =
GammaArray[2][iIndex] = (WORD)iArrayValue;

}
bReturn = SetDeviceGammaRamp(hGammaDC, GammaArray);
}

if (hDC == NULL)
ReleaseDC(NULL, hGammaDC);

return bReturn;
}

回复对我来说很重要。 提前致谢

0 个答案:

没有答案