Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As _
Long
Private Const KEYEVENTF_KEYUP = &H2
Sub changeKey(Key As Byte, ByVal newState As Boolean)
If CBool(GetKeyState(Key)) <> newState Then
keybd_event Key, 0, 0, 0
keybd_event Key, 0, KEYEVENTF_KEYUP, 0
End If
End Sub
سه تا command button بزار به نام هاي command1 , command2 , command3
Private Sub Command1_Click()
Dim bool As Boolean
Dim keyname As Byte
bool = Not CBool(GetKeyState(vbKeyCapital))
Call changeKey(vbKeyCapital, bool)
End Sub
Private Sub Command2_Click()
Dim bool As Boolean
Dim keyname As Byte
bool = Not CBool(GetKeyState(vbKeyNumlock))
Call changeKey(vbKeyNumlock, bool)
End Sub
Private Sub Command3_Click()
Dim bool As Boolean
Dim keyname As Byte
bool = Not CBool(GetKeyState(vbKeyNumlock + 1))
Call changeKey(vbKeyNumlock + 1, bool)
End Sub
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum