Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
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
0 OriginalGriff 205
1 Sergey Alexandrovich Kryukov 185
2 jlopez788 144
3 Rob Philpott 100
4 Prakriti Goyal 97
0 OriginalGriff 6,837
1 Sergey Alexandrovich Kryukov 5,559
2 Maciej Los 3,479
3 Peter Leow 3,323
4 DamithSL 2,505

Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
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