Can I control other process UI and input some data ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?S2lk?=

    Can I control other process UI and input some data ?

    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]

    #2
    Re: Can I control other process UI and input some data ?

    "Kid" <Kid@discussion s.microsoft.com wrote in message
    news:CC912098-E45E-4A70-82C0-5816011877D8@mi crosoft.com...
    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
    EnumChildWindow s. 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]

    Comment

    • David Ching

      #3
      Re: Can I control other process UI and input some data ?

      "Kid" <Kid@discussion s.microsoft.com wrote in message
      news:CC912098-E45E-4A70-82C0-5816011877D8@mi crosoft.com...
      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

      Comment

      Working...