sendhil_an
asked on
System.Windows.Forms.SendKeys
hi,
Iam having a small problem in using the System.Windows.Forms.SendK eys API to send input to an active appication. I have an exe file for adding two numbers. I have to give input to that and get the result. My code ( which i have given below) works sometime and does not work someother time. It gives and unhandled exception error. can anyone tell me why?
Dim myProcess As Process = New Process()
myProcess.StartInfo.FileNa me = "Addition.exe"
myProcess.StartInfo.Window Style = ProcessWindowStyle.Normal
myProcess.EnableRaisingEve nts = True
myProcess.Start()
Try
If myProcess.Responding Then
System.Windows.Forms.SendK eys.SendWa it("2")
System.Windows.Forms.SendK eys.SendWa it("{ENTER }")
System.Windows.Forms.SendK eys.SendWa it("3")
System.Windows.Forms.SendK eys.SendWa it("{ENTER }")
System.Windows.Forms.SendK eys.Send(" {ENTER}")
System.Windows.Forms.SendK eys.Flush( )
Else
myProcess.Kill()
End If
-sendhil
Iam having a small problem in using the System.Windows.Forms.SendK
Dim myProcess As Process = New Process()
myProcess.StartInfo.FileNa
myProcess.StartInfo.Window
myProcess.EnableRaisingEve
myProcess.Start()
Try
If myProcess.Responding Then
System.Windows.Forms.SendK
System.Windows.Forms.SendK
System.Windows.Forms.SendK
System.Windows.Forms.SendK
System.Windows.Forms.SendK
System.Windows.Forms.SendK
Else
myProcess.Kill()
End If
-sendhil
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: brother7 {http:#9624332}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TheLearnedOne
EE Cleanup Volunteer