【发布时间】:2019-09-05 07:31:07
【问题描述】:
我是使用 windows.h 库和从 windows 等获取信息的初学者。 我编写了一个代码来查找任何窗口的像素颜色。我不知道我出了什么问题。
#include <iostream>
#include <windows.h>
using namespace std;
COLORREF centerColor;
POINT cent;
int main()
{
HWND hd = FindWindow(NULL, L"Untitled - Notepad");
HDC hdc_ = GetDC(hd);
cent.x = 0;
cent.y = 0;
centerColor = GetPixel(hdc_, cent.x, cent.y);
cout << centerColor;
}
【问题讨论】: