keybd_event - 模擬keyboard 按鍵
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Call keybd_event([ASCIIKeyCode], 0, [press=0/release=2], 0)
- bVk - Specifies a virtual-key code. The code must be a value in the range 1 to 254.
- bScan - Specifies a hardware scan code for the key.
- dwFlags - Specifies various aspects of function operation. An application can use any combination of the following predefined constant values to set the flags.
- dwExtraInfo - Specifies an additional 32-bit value associated with the keystroke.
for detail
GetAsyncKeyState - 獲得按鍵狀態
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vkey As Long) As Integer,
- vKey - Specifies one of 256 possible virtual-key codes.
當個制係按下狀態既時候 會回傳一個負值數字
加個Function check 佢係咪負值就可以了
例如:
Public Function IsKeyDown(KeyCode As Integer)As Boolean
IsKeyDown = (GetAsyncKeyState(KeyCode) < 0) '係呢句入面A<=B就會比個True你,係判斷式
End Function
for detail
★Kit↘..