hello,
i trying to build a program which takes (on mouse click) the text of
any
given input text box on any window and change it.
how do i get the object of the text box and set my text to its value.
thanks...
This is a discussion on get an object from a window and editing it within the Windows Programming forums, part of the Platform Specific Boards category; hello, i trying to build a program which takes (on mouse click) the text of any given input text box ...
hello,
i trying to build a program which takes (on mouse click) the text of
any
given input text box on any window and change it.
how do i get the object of the text box and set my text to its value.
thanks...
To get the window the cursor is over:
Then you can call GetWindowText with the handle and SetWindowText with the modified text.Code:GetCursorPos(&pt); hwnd = WindowFromPoint(pt);
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
My bad.
You need to send WM_SETTEXT directly.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Thanks for the fast reply![]()
i got the position with GetCursorPos like you said,
but getting the handler of the whole window was not good for me, so i used AccessibleObjectFromPoint() to get IAccessible.
it was good enough for reading the tex but i couldn't figure out how to set the text,
(set_accValue didn't work). is there a SETTEXT message for Iaccessible?
No idea; never used it.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
You'll probably have to enumerate thru the windows to find the window in question. Give the following a try:is there a SETTEXT message for Iaccessible?
Call get_accChildCount
Enumerate the child windows based on what is returned from get_accChildCount
Attempt to get an Idispatch interface for the child
Convert the Idispatch interface to an IAccessible interface
Call WindowFromAccessibleObject to get window handle
Call SendMessage using handle returned from WindowFromAccessibleObject function with WM_SETTEXT to send message to the targeted window.
At this point you could continue recursively to identify other child windows.
I haven't tested the above, It's just my interpretation of the MSDN docs.