troubleshooting Question

how use send keys to enter text in notepad

Avatar of down0041
down0041 asked on
Visual Basic.NETEmail Servers
9 Comments3 Solutions2156 ViewsLast Modified:
I have a form, and I would like to send keys to notepad.  I can make notepad the active window, but the send keys command does nothing.  Any help greatly appreciated.  Please see code below.

    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function SetActiveWindow Lib "user32" Alias "SetActiveWindow" (ByVal hWnd As Long) As Long
    Private Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long

    'Make notepad the active window
    Dim myTest As Long
    myTest = WindowHandle("Untitled - Notepad")

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros