Can I control other process UI and input some data ?

  • Thread starter Thread starter Kid
  • Start date Start date
K

Kid

Hi

How can I control other process UI and input some data value like input edit
box or click button controls ?

Is there some good sample code and tool to help me ?

Thank you .
 
Kid said:
Hi

How can I control other process UI and input some data value like input
edit
box or click button controls ?

Is there some good sample code and tool to help me ?

Thank you .

There is no all-purpose solution but many things can be done by sending
standard windows messages to HWNDs in the other process. First use the
Spy++ tool to find the IDs of the controls you are interested in. In your
program, find the HWNDs of these controls by using FindWindow and
EnumChildWindows. As you enumerate the child windows use GetClassName and
GetWindowLong with GWL_ID to recognize and store the child HWNDs you need.

You can input text to an edit control with SendMessage(... WM_SETTEXT...).
You can click controls by sending the same message to the parent dialog that
the control sends, such as WM_COMMAND with BN_CLICKED.
 
Kid said:
Hi

How can I control other process UI and input some data value like input
edit
box or click button controls ?

Is there some good sample code and tool to help me ?

Thank you .

The most reliable way is if the other process is in the foreground, you can
simulate keystrokes/mouse events using SendInput().

-- David
 
Back
Top