Monday, 9 September 2013

Retrieving textBox handles

Retrieving textBox handles

I'm currently working on a project to provide interop between two
unrelated pieces of software. I need to pass the data from a
textBox/textBoxes, into a textBox of the other said app.
My current idea is to find the handle of the target control, make it
active, and enter the data by copying it to the clipboard, and pasting it
via:
Clipboard.SetText(textBox1.Text, TextDataFormat.Text);
SendKeys.SendWait("^V");
As textBoxes have no 'caption', handles are dynamically assigned on the
process start, and class names are appended with various data regarding
the process, is it possibly to get a handle for an object within a window
via some sort of indexing? I'd be more than willing to find the correct
handle by trial and error if need be, as long as it would be consistent
for every instance of the application.
Thanks in advance
A.

No comments:

Post a Comment