Click here to Skip to main content
13,042,819 members (78,910 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Is there a way you can send a Paste or SendKeys to a control on an external window, if you know the Handel by using Spy++?

Or even set focus to that window and then to the control? Then SendKeys
Posted 28-Dec-12 4:50am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yep, of course this is possible.
you can achive this by using P/Invoke technologi in .NET environment.

So basically you must retreive a window handle (HWND) by it text (caption) and
mark this window as foreground with help of (WIN32 API):
private static extern bool SetForegroundWindow(IntPtr hwnd);

private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

and then you might just send data like

Or even more with help of
SendMessage(_hWnd, 0x100, (int) VKeys.VK_2, (int) VKeys.VK_2);

you can achive better result

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100