Quantcast

Jump to content

» «
Photo

[.NET]SendKeys.Send Inf. Loop

1 reply to this topic
coldmurda
  • coldmurda

    Ghetto Star

  • Members
  • Joined: 30 Jul 2007
  • None

#1

Posted 09 October 2012 - 04:20 AM

So to keep it simple, I'm basically integrating a Compiler into a GUI with a button to send Text commands to CMD
Code:
Private Sub btnCPL_Click( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles btnCPL.Click
CODE
       Shell("CMD.exe")
       SendKeys.Send(txtSCOCL.Text)
       SendKeys.Send(" 0x7DD1E61C ")
       SendKeys.Send(txtC.Text)
       SendKeys.Send(" ")
       SendKeys.Send(txtOUT.Text)
       SendKeys.Send("{ENTER}")
End Sub

Problem: When I run the first compile, it's flawless. But upon clicking again, it appears the
SendKeys.Send("{ENTER}")
line gets stuck on my Compile button and constantly opens Command Promt (CMD.exe) over and over (non-stop)



So the question is, would there be a line to add after the {ENTER} to stop/rest the script?

nightwalker83
  • nightwalker83

    Don't mind me

  • Members
  • Joined: 10 Oct 2004

#2

Posted 10 October 2012 - 08:25 AM

You could probably use a Boolean and after you press the button the first time set it to true after initializing it as false then surround you code with conditional statement that checks whether the operation has been carried out. If the Boolean is true then it has.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users