Page 1 of 1
Use Point with a DC
Posted: Fri Mar 12, 2004 12:20 pm
by willib
HI all
I want to Programm something that reads out the Top screen and analyse it ( in real I want to find a chess board )
I can get the primary screen in a DC
now i must find a rectangle in it
therefor I need the point(X,Y) colors of the DC but
I cant find a function for this.
The sense of the Project is to let 2 Chess Programms play against each other over IP.
Can someone give me a hint
Posted: Fri Mar 12, 2004 1:29 pm
by Kale
The sense of the Project is to let 2 Chess Programms play against each other over IP.
Maybe a better way to achieve this is to break the board down into a simple 2d array (x,y) 'Dim'ed from a Structure describing that square (empty/what piece is there). Then just communicate this array between programs and let the AI use the opponents array for making descisions. Then display the results to the screen in a nicely drawn chess board. Maybe a little easier than trying to find out what is being displayed on the screen, etc.

Posted: Fri Mar 12, 2004 2:17 pm
by willib
HI again
I do not want to code the chess programm itselfs.
There are several programs like Fritz or Genius but then do not communicate with all of them. So I like to make them play against each other that way
Its a long way to go ......
Posted: Fri Mar 12, 2004 2:27 pm
by LarsG
Isn't there some API call to get the width and height of a DC?! I would assume there is some anyways.. then you'd be able to grab it as an image, and transmit this as a file over the network.. I think?!?

Posted: Fri Mar 12, 2004 7:33 pm
by Kale
To retrieve a colour at the given coord (WinAPI):
Code: Select all
RGBValue = GetPixel_(HDC, XPos, YPos);
To retrieve the width and height of the device context use (WinAPI):
Code: Select all
GetBoundsRect_(HDC, Bounds.RECT, #NULL)
Debug Bounds\Right
Debug Bounds\Bottom
Get a Good WinAPI reference and all can be found, try here:
http://www.garyw.uklinux.net/PB/WIN32.zip
or
http://www.mentalis.org/agnet/apiguide.shtml
Posted: Sun Mar 14, 2004 5:53 pm
by willib

Thanks I will try it out next week
Willi