Hello.
I am currently creating a software that requires the detection of "cheating."
While my software is open, players will not be allowed to have certain types of content open.

Ex:
---
Lets say that my software, is a Chess Server. In order to prevent cheating, my software must be able to "detect" whether or not a player has any windows open that have anything relating to chess. Upon detection of such a window, the player will be prompted to close out any chess related programs he or she may be running.

Is there any way to "read-in" the text of the current "active" window? Thank you.

Are you trying to write a SpyBot? I'm not going to be the one to help you with that... are you also trying to read the credit card numbers that people might be writing on other open windows, while they are "playing your game"... just joking!

To be fair, I will presume your innocence before proof of guilt... so to answer the question, I don't think that this is possible within normal channels (i.e. without some dirty hacks) for obvious security reasons. And I can't remember ever seeing a software do that except viruses or other undesirables, anti-viruses don't even do that! At least, as far as I know, and I hope I'm right! The IT world is no place for Big Brother.

Hmm. I'm sorry. I should have been more specific. The detection of "cheat" software is already implemented in a well known software, called Chessbase.com. All I want to be able to do is recognize whether or not a player has any chess programs open while he or she is playing on my server. The only way I saw to go about doing that was to possibly read in text that was inside of open programs the user might have; to check to see if the word "chess" was written there-in. If there is another way I would be more than happy to hear it.

Here is how the anti-cheat code works on the renown chess website: If you have any programs open with chess-related content, you will be warned to close those programs out (or you will forfiet the current game you are playing).

I have no idea how the software is able to detect when anything chess related is open, but it does.

Example: While I was playing on the anti-cheat software, I happend to visit a chess website. A few seconds later, the chess software prompted me to close all chess related content or I would forfeit the game.

By the way: Passwords are "normally" encrypted; so even if I were to retrieve the text of any open document, the password would come up as all astericks (*****). However, I completely see your point. Retreiving the text of certain open docuements could indeed lead to very malicious activity.

You can get all window titles by using the WinAPI function EnumWindows. To get the active window, you can use GetForegroundWindow.
But like all cheat protections, it can be easily bypassed. What if I just don't create a window for my cheat program and instead operate the chess program directly? What if I have a chess program running on another computer where I replay the opponent's moves?

Thank you so much for your reply. Yes, I've considered that there are indeed methods of by-passing the cheat protection; however, it will prevent the main method of cheating (which is to simply have a chess program open and play back the moves).

Also, playing back moves on another pc requires time. In "timed" games, such as a 1 minute chess game, players will really not be able to play out an entire game on another pc, then copy those same moves in game.

The average chess player will not know how to bypass the anti-cheat software (other than using another computer), because he or she will not know what is causing the software to prompt him or her to close the chess software he or she currently has open.

Again, your response has answered my question fully, thank you again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.