프로그래밍언어/VB.NET

Sendkeys

부산딸랑이 2013. 3. 6. 21:08


'My.Computer.Keyboard.SendKeys("보낼 문자", True)

계산기켜고 계산기에서 "55*3=" 값 보내기


Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ProcID As Integer ' Start the Calculator application, and store the process id.

        ProcID = Shell("CALC.EXE", AppWinStyle.NormalFocus) ' Activate the Calculator
        

      System.Threading.Thread.Sleep(1000)


        AppActivate(ProcID)
        My.Computer.Keyboard.SendKeys("55", True)
        My.Computer.Keyboard.SendKeys("*", True)
        My.Computer.Keyboard.SendKeys("3", True)
        My.Computer.Keyboard.SendKeys("=", True) ' The result is 22 * 44 = 968.
    End Sub
End Class