-
May 19th, 2009, 06:12 PM
#1
System Hooks needed?
I am working on a little side project that needs to read information from a text box of another program. I have used FindWindow, FindWindowEx, GetWindowText and was able to grab the initial values of the text box. The problem is that this is an ever changing value that I want to monitor in real time. Let me give you an example of what is happening and what needs to happen.
Output.exe is putting a random number into TextBox1 with an initial value of 1.5. I programmed GetText.exe to grab the text from TextBox1 and it does this successfully every time I run through the routine, but it will always return the inital value of 1.5 it wont change with Output.exe.
From what I have found thus far I think I am going to have to establish a System hook to monitor the text box in real time. My question is pretty much what API's should I be looking at, what types of web resources are there for this type of application, and is this NT/2000/XP/Vista specific or will I be able to port to a 9x machine?
Any and all help is appreciated.
-
May 20th, 2009, 01:35 AM
#2
Re: System Hooks needed?
I would suggest DDE.
Initially I thought of the PeekMessage API, but the problem is that VB6 applications retrieve all messages using GetMessage, and they'll never stay in the queue long enough for you to pick them up.
With DDE you can use the LinkTopic, LinkItem, LinkMode, LinkTimeout properties.
Here is a very good article about DDE :
http://www.codeguru.com/vb/gen/vb_ge...le.php/c11549/
-
May 20th, 2009, 07:55 AM
#3
Re: System Hooks needed?
If you have already established a method using FindWindowEx and GetWindowText, why not doing this always again whenever you want to get the text out of the textbox-window.
Run a timer which will do this chain of scanning:
a) Find the main window handle
b) find the window handle of the TextBox
c) Get the contents of the TextBox
Usually the handles of a window don't change until the window is closed and then reopened...
Another thought about getting the text from the TextBox:
Use SendMessage together with EM_GETTEXTEX code to fetch the text.
You can research this at MSDN, if you are unseccessful, I shall see if I can find some sample.
-
May 24th, 2009, 10:34 PM
#4
Re: System Hooks needed?
Originally Posted by WoF
If you have already established a method using FindWindowEx and GetWindowText, why not doing this always again whenever you want to get the text out of the textbox-window.
Run a timer which will do this chain of scanning:
a) Find the main window handle
b) find the window handle of the TextBox
c) Get the contents of the TextBox
Usually the handles of a window don't change until the window is closed and then reopened...
Another thought about getting the text from the TextBox:
Use SendMessage together with EM_GETTEXTEX code to fetch the text.
You can research this at MSDN, if you are unseccessful, I shall see if I can find some sample.
I have done this already and it keeps on returning the original value of 1.5. I will try the DDE Method and let you guys know how it goes, thanks.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|