dim control as boolean
dim one as boolean
private sub form1_keydown()
if e.keycode = keys.control then
control = true
elseif e.keycode = keys.1 then
one = true
end if
if control and one then
messagebox.show("CONTROL + 1")
end if
end sub
private sub form1_keyup()
if e.keycode = keys.control then
control = false
elseif e.keycode = keys.1 then
one = false
end if
end sub
Public Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.D1 And e.Modifiers = Keys.Control Then
TextBox1.Text = "forcefood"
End If
End Sub
sendkeys.send("forcefood")
Would i need "GetASynchKeyState" for it to work or?DiverDan said:I think using e.Modifiers would be a bit simplier that the Boolean.
Visual Basic:Public Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.D1 And e.Modifiers = Keys.Control Then TextBox1.Text = "forcefood" End If End Sub
i did, and it gave me some crap about cars, google sucksthenerd said:As I've said. GetASynchKeyState should get you the State of the Keys at any given time, not sure how to use it. Look it up on google.
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As Short
Here is a crazy idea: search MSDN.i did, and it gave me some crap about cars, google sucks
MSDN said:Parameters
vKey
[in] Specifies one of 256 possible virtual-key codes. For more information, see Virtual-Key Codes.
Windows NT/2000/XP: You can use left- and right-distinguishing constants to specify certain keys. See the Remarks section for further information.
Return Value
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState