Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Jackbunny

Sending Text In Windows

This topic is 5577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there! Quick question I hope one of you C++ gurus can help me with. I''m trying to send text to a word processor window. Basically I execute my program and it switches to the background and sends text to target window. Any ideas on how to do this? More specifically, which api call do I need to use to send the text. Thanks a bunch.

Share this post


Link to post
Share on other sites
Advertisement
You can use keybd_event() to send keystrokes to the topmost window. If you don''t need compatibility with Windows 95/98/Me, you should use SendInput.


For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!

Share this post


Link to post
Share on other sites
The "correct" way to do this would be to use SendMessage to send faked key strokes to the window. You can use FindWindow() and FindWindowEx() to locate the window handle of the text box you want, then you have to send a WM_CHAR message via SendMessage() to the text box. You have to fill out wparam and lparam correctly (I don''t remember which is what). But it''s not that hard. You can write a function that will send a single char to the text box, then from that write another function that sends strings to the text box.

If you do it this way, you don''t have to worry about which program is on top or whatever. You can minimize both programs and it will still work.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!