How to read the screen pixels?

后端 未结 5 1667
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 08:17

I want to read a rectangular area, or whole screen pixels. As if screenshot button was pressed.

How i do this?

Edit: Working code:



        
5条回答
  •  萌比男神i
    2020-12-01 09:13

    You can use the code below to read the screen pixels:

    HWND desktop = GetDesktopWindow();
    HDC desktopHdc = GetDC(desktop);
    COLORREF color = GetPixel(desktopHdc, x, y);
    

提交回复
热议问题