minesweeper/GetPixel()

Hi, I'm trying to write a program that plays a minesweeper game by itself. I
think I can write all of the code just fine, but I don't know how to have the
program realize which buttons are which in real time. I was thinking that I could just have it return the color of a certain pixel inside the button since the numbers have different colors. I tried using GetPixel(), but I don't know what exactly to #include, or what namespace to use. If someone could explain that or give me any other ideas that would be great! Thanks.

Here is my attempt for code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <cstdlib>
#include <Windows.h>
#using <mscorlib.dll>

using namespace std;
using namespace System;

void click(int x, int y)
{
	SetCursorPos(x, y);
	Sleep(50);
	mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
	mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
}
int main()
{
	click(1451, 13); //minimize
	//click(813, 373); //main app
	//click(834, 514); //center
	click(762, 455); //start
	// Get the color of a pixel within myBitmap.
	Color pixelColor = myBitmap->GetPixel(50, 50);
}
Last edited on
what IDE/compiler are you using?
Microsoft Visual Studio 2013?
Topic archived. No new replies allowed.