• Advertisement
Sign in to follow this  

Getting Input From a Window

This topic is 4434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I dont know if this belongs here or .net, platform is Windows (XP). Hey guys, I'm not sure if I named my thread right, but here goes. My goal is to create an application that will receive and analyze window xyz's output. So, have this game based on the quake 3 engine. It has a 'console', which is seperate from the main window. This console shows the output of all the events that have happened, who said what in chat, etc. What I want to do is analyze this output in my program so that I could do certain things based on the output. Say in game my name is Player, and I say !hello, the program would scan the output for !hello, and then do accordingly. I know this could be done since there are many examples (killtrackers). I had a control in VB.Net that did particularly this, however, the source wasn't included. I've asked the guy who made it and all he tells me is it was done using the .net framework. I dont know if he means the GUI part or the actual system part where it analyzes the output of the console. In my understandment, a window could be a button. Basically I'd like to know how I could see what the text in a certain button (for which I have the window handle etc.) is, so then I could later analyze this text and compare it against my variables. Perhaps a button isn't the best example, since I am mostly accessing this 'console' by it's name (maybe by using the FindWindowEx function passed with the window name). After I have this 'window', I'd like to analyze, or better yet, 'capture' this data into my program. Am I clear? Could someone please point me in the right direction?

Share this post


Link to post
Share on other sites
Advertisement
If you can get an HWND of a window that's a common windows control (i.e. a button, an edit box, etc), you can send the WM_GETTEXT message (or call the GetWindowText function) to get whatever text is being displayed by the control.

If it's not a common control you may get lucky and they may be setting their text in a way that you can still get it back via WM_GETTEXT.

If you're using VB or .NET you'll likely need to hack out the SendMessage() function. Search MSDN for calling a dll out of a function or something like that and you should be able to get a sample.

Another option would be if the console outputs text to a log file, or has another function / message that it supports to pull the text.

HTH

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement