Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I control other process UI and input some data ?

0 views
Skip to first unread message

Kid

unread,
Oct 14, 2008, 8:51:01 PM10/14/08
to
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 .

Scott McPhillips [MVP]

unread,
Oct 14, 2008, 11:21:09 PM10/14/08
to
"Kid" <K...@discussions.microsoft.com> wrote in message
news:CC912098-E45E-4A70...@microsoft.com...

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.

--
Scott McPhillips [VC++ MVP]

David Ching

unread,
Oct 16, 2008, 7:28:11 PM10/16/08
to
"Kid" <K...@discussions.microsoft.com> wrote in message
news:CC912098-E45E-4A70...@microsoft.com...

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

-- David

0 new messages