I have this code that gets the color of 4 pixels off the screen and checks them to see if they are white, but I am getting an error at INPUT saying that it is an unknown identifier. Any help?
Code:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
HDC hdcScrn;
hdcScrn = CreateDC((LPCWSTR)"DISPLAY", 0, 0, 0); //Capture the screen
COLORREF Col1,Col2,Col3,Col4; //Colors
POINT LP, RP, UP, DP;
LP.x = 374;LP.y = 391;
RP.x = 627;RP.y = 387;
UP.x = 533;UP.y = 362;
DP.x = 467;DP.y = 415;
//Define the input keys
INPUT Left, Right, Up, Down;
Left.type = INPUT_KEYBOARD;
Right.type = INPUT_KEYBOARD;
Up.type = INPUT_KEYBOARD;
Down.type = INPUT_KEYBOARD;
Left.ki.wVk = VK_LEFT;
Right.ki.wVk = VK_RIGHT;
Up.ki.wVk = VK_UP;
Down.ki.wVk = VK_DOWN;
while (true)
{
//SetActiveWindow(hWnd);
Col1 = GetPixel(hdcScrn, LP.x, LP.y);
Col2 = GetPixel(hdcScrn, RP.x, RP.y);
Col3 = GetPixel(hdcScrn, UP.x, UP.y);
Col4 = GetPixel(hdcScrn, DP.x, DP.y);
if (Col1 == 16777215)//left
{
SendInput(1, &Left, sizeof(INPUT));
}
if (Col2 == 16777215)//right
{
SendInput(1, &Right, sizeof(INPUT));
}
if (Col3 == 16777215)//up
{
SendInput(1, &Up, sizeof(INPUT));
}
if (Col4 == 16777215)//down
{
SendInput(1, &Down, sizeof(INPUT));
}
}
DeleteDC(hdcScrn); // deletes the handle
return 0;
}
Edit: Had the POINT stuff screwed up, fixed now.