Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to send keystrokes to another running application using VB 6.0? I tried using SendKeys by AppActive, but its not working. I need to access using Win32 API. I am automating an application using VB 6(We cannot use any 3rd party libraries like AutoIT or something)Can anyone please suggest me how to send keystrokes to another application using VB
Posted

1 solution

An example at MSDN:
<pre>
Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I &amp; "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
</pre>
I copied the example because today there's no luck in posting links...
<a href="http://msdn.microsoft.com/en-us/library/aa266281%28VS.60%29.aspx">http://msdn.microsoft.com/en-us/library/aa266281%28VS.60%29.aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/aa266281%28VS.60%29.aspx" target="_blank" title="New Window">^</a>]
.
:)
 
Share this answer
 
v5

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900