How would I make a program that can insert text into a text field in another program? Or click a button in another program?

Recommended Answers

All 6 Replies

What you would need there - and you are best off just googling for this - is a thread/process-specific keyboard hook. Essentially allowing you to monitor/insert keyboard events into a running application's queue.

What you would need there - and you are best off just googling for this - is a thread/process-specific keyboard hook. Essentially allowing you to monitor/insert keyboard events into a running application's queue.

Thanks for the reply. I tried searching that and different variations of that, and I got a lot of stuff for the keyboard hook but nothing in how to insert events into an application's queue. Can anyone help me out there?

You don't need hooks for that...

commented: Aren't you just full of information. -1

How would I make a program that can insert text into a text field in another program? Or click a button in another program?

You could implement your application as one which communicates with it's own instances over a network, then you can let your program send messages to the other instance, when the other instance recognizes the right message you could for example change the text in a text field :)

That's if it is the same program though.

You don't need hooks for that...

That's just an incredibly unhelpful and uninformative post.

Of course you don't need to use hooks, they aren't the only choice but it seems you don't have/know an alternative anyway. So I will suggest another, the SendInput win32 function, which may be appropriate depending on the application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.