I'm personally making a On-Screen Number Pad right now for users who use laptops. And when I debugged it, and tried it, it doesn't work! So I'm guessing I need to have a target process or something. But I don't know how! Help! Here's my code:
[PHP]Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim TargetProcess As Process() = Process.GetProcessesByName(TextBox1.Text)
End Sub
End Class[/PHP]
That's the TargetProcess. Here's the Number Pad:
[PHP]Public Class Form2
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub AlwaysOnTopToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlwaysOnTopToolStripMenuItem.Click
If AlwaysOnTopToolStripMenuItem.Checked = True Then
Me.TopMost = True
Else
Me.TopMost = False
End If
End Sub
Private Sub Button0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button0.Click
SendKeys.SendWait(Keys.NumPad0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SendKeys.SendWait(Keys.NumPad1)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SendKeys.SendWait(Keys.NumPad2)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
SendKeys.SendWait(Keys.NumPad3)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
SendKeys.SendWait(Keys.NumPad4)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
SendKeys.SendWait(Keys.NumPad5)
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
SendKeys.SendWait(Keys.NumPad6)
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
SendKeys.SendWait(Keys.NumPad7)
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
SendKeys.SendWait(Keys.NumPad8)
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
SendKeys.SendWait(Keys.NumPad9)
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
SendKeys.SendWait(Keys.Divide)
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
SendKeys.SendWait(Keys.Multiply)
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
SendKeys.SendWait(Keys.Decimal)
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
SendKeys.SendWait(Keys.Enter)
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
SendKeys.SendWait(Keys.Add)
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
SendKeys.SendWait(Keys.Subtract)
End Sub
End Class[/PHP]
Help!
Wouldn't it just be easier to make a timer for each button lets say we have button1 and timer1 heres how it could be:
button1:
Timer1.start
Timer1:
sendkeys.send("1")
then for the rest of the buttons just replace the 1 with whatever eg:
edit: SHIT SORRY FOR BUMP didn't realize date, this guy needed help though :/ sorry .. should i delete this post?
/moved to vb section.
Have fun guys
Why would you want to send those keys btw?
Sendkeys isn't working in Games btw.
Originally Posted by NextGen1
/moved to vb section.
Have fun guys
Uh it was a 3 week bump. Ohsnap.
Originally Posted by Blubb1337
Why would you want to send those keys btw?
Sendkeys isn't working in Games btw.
I think his problem was sending the keys to a target process, because it's an on-screen keyboard you have to have that formed focused to click the keys, so that means it will only send the keys to the "keyboard form", essentially useless. He needs to know how to send the keystroke to an open process.
I made a C# project which had a touch screen keyboard, back in that time (was at school), i was working with MDI, and i was focusing the last write-able control that was selected, and then executed send keys.
About sending it to another application.. well.. you can always try Postmessage/Sendmessage...
Or before the Sendkeys.Send() code, find the process hwnd and use SetForegroundScreen(), plus to send keystrokes.. sendkeys won't work (i think j-deezy said that already), so use another API.
Edit: although it's an old topic, it might be useful for someone else with the same problem. (Anyway they never use search)