.net 電卓 起動 SendKeys 終了 イベント 取得 | 備忘録 (。・_・。)ノ


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim ps As New Process()

        ps.StartInfo.FileName = "calc.exe"

        Button1.Text = "電卓実行中…"

        ps.Start()

        TextBox3.Text = ""

        'System.Diagnostics.Process.Start("calc.exe")

        System.Threading.Thread.Sleep(1000)

        System.Windows.Forms.SendKeys.Send(TextBox1.Text)

        System.Windows.Forms.SendKeys.Send("*")

        System.Windows.Forms.SendKeys.Send(TextBox2.Text)

        System.Windows.Forms.SendKeys.Send("=")

        System.Windows.Forms.SendKeys.Send("^c")

        While Not ps.HasExited

            System.Threading.Thread.Sleep(500)

            Application.DoEvents()

        End While

        If Clipboard.ContainsText() Then TextBox3.Text = Clipboard.GetText()

        Button1.Text = "計算開始"

    End Sub

End Class


アマゾン限定品