[Dev-C++] Detection of windows. Java programmer needs C help.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <jrg...@ya...> - 2005-11-19 18:26:54
|
Hello everybody. Here's the background story. I love to play scrabble online (for you = Swedes who reads this, visit www.betapet.com if you want to play). I have = written a small program that helps me to keep track of which the remaining letters = are (click on the link for a screenshot: http://www.holdemprogs.com/Tracker.jpg). As it is now I manually either = have to type in the letters or use my mouse by clicking on the letters when I want to reduce the number of unknowns. During the game I more or less = always at some point forget to update my little program forcing me to reset and reenter all of the known letters in the input field. I thought if I = could automate the process of updating it would be great. As far as I know = there are two ways of finding out which the new letters being put on the board are: 1) Using some sort of sniffer (I think that's what it called) that = listens to the communication between the browser and the game server=20 or 2) Image processing by comparing screenshots. I personally have no idea how to do the first, so I'm going to go with = the second option, using some sort of neural network. I could of course take a screenshot of my whole screen and do the = processing from there, but I feel that that will cause unessecary load to the CPU. = This bring me to the real reason of this letter. I would like to identify the game window by getting the text in the title bar and when a positive identification is made find out the size and position of the window. = This is not something I can do directly in Java but I think it could be done by using JNI (Java Native Interface). Unfortunatelly my limited knowledge = of C and C++ doesn't include Windows API programming so I'm totally stuck. At Planet Source Code I found a piece of code, see http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3D657= 3&lng WId=3D3, that alters the window text of the active window by adding the current memory status. From this code I could figure out that the = function GetWindowText(=85) was used for getting the text in the title bar, but I = din't get much of the rest. I would really appreciate if any of you guys could help me out by = writing source code for the below methods. string[] getWindowTextForAllWindows() int getX(string windowText) int getY(string windowText) int getWidth(string windowText) int getHeight(string windowText) bool isWindowActive(string windowText) // If the window isn't in front there's no use in taking a screenshot A thousand thanks in advance and best regards, J=F6rgen Persson |