Capturing Text / Telnet Client
Posted: Thu May 27, 2010 6:18 pm
I've got a telnet program (SmarTerm) that my company uses. I was wondering about monitoring and periodically capturing text from the program without user interaction and without interrupting their work in the program. Basically I want to make an assistant program that can give them additional information based on what screen their in at the time.
A did a window/child window output of the main program and got this:
The two items of interest seem to be the Session.stw/SmarTermClassSCO0 and SocketTelnet/SocketTelnet windows. GetWindowText_() on either of these doesn't, of course, return the actual display text.
In fact, I'm thinking the displayed text may simply be painted text rather than pure text and that would pretty much mean I'm out of luck.
The user does have the ability (within the program) to select the current screen and copy it to the clipboard. I cannot/will not do a SendKeys() to replicate this as it would interrupt what the user is doing.
If I could get a hook into the telnet stream I could parse it for what I need but I'm not sure where to start there.
Any thoughts on this?
A did a window/child window output of the main program and got this:
Code: Select all
19334394 59648 MDIClient 1163 673
7210672 65280 Session.stw SmarTermClassSCO0 1171 700
6358916 59648 AfxFrameOrView42 1159 669
3409596 0 SocketTelnet SocketTelnet 0 0
6031170 59419 AfxControlBar42 1159 0
4392938 59422 AfxControlBar42 1159 0
3868628 59420 AfxControlBar42 0 669
7669534 59421 AfxControlBar42 0 669
3409578 59392 AfxControlBar42 1159 0
3081504 59393 Afx:400000:8:10011:10:0 1189 17
1180898 59419 Standard AfxControlBar42 1189 39
3605804 59392 Standard Afx:400000:8:10011:10:0 708 39
1311788 59422 AfxControlBar42 1189 0
1180704 59420 Control Bar AfxControlBar42 0 719
18154958 256 Control Bar AfxWnd42 0 0
7603702 59648 Afx:400000:0:10011:6:0 0 0
2426528 60160 AfxWnd42 0 0
1312418 59920 ScrollBar 16 1
6424052 59904 ScrollBar 1 16
13698444 60161 AfxWnd42 0 0
6162020 59920 ScrollBar 16 1
6423960 59904 ScrollBar 1 16
6686124 60162 AfxWnd42 0 0
11863556 59920 ScrollBar 16 1
7341450 59904 ScrollBar 1 16
1312414 60163 AfxWnd42 0 0
5441140 59920 ScrollBar 16 1
2950706 59904 ScrollBar 1 16
3409332 60164 AfxWnd42 0 0
10618450 59920 ScrollBar 16 1
9438618 59904 ScrollBar 1 16
10683910 60165 AfxWnd42 0 0
6489578 59920 ScrollBar 16 1
23135634 59904 ScrollBar 1 16
1246246 59421 AfxControlBar42 0 719
In fact, I'm thinking the displayed text may simply be painted text rather than pure text and that would pretty much mean I'm out of luck.
The user does have the ability (within the program) to select the current screen and copy it to the clipboard. I cannot/will not do a SendKeys() to replicate this as it would interrupt what the user is doing.
If I could get a hook into the telnet stream I could parse it for what I need but I'm not sure where to start there.
Any thoughts on this?