Lc_KiT : 個人主頁 - 相簿 - 訂閱  [ QOOZA - 論壇 - 登入 ]
406 - Not Acceptable
 
2010 年 7 月 4 日  星期日 2010-07-04 03:27 PM


API - keybd_event , GetAsyncKeyState

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↘..

 [ 訪客留言(1) ] [ 編輯日誌 ] [ 分享至FACEBOOK ]
MySelf
暱稱: Tikwal
性別: 男
國家: 香港
地區: 元朗區
++水晶音樂盒++
Mariage D'Amour
最近訪客
最近沒有訪客
訪客留言
最近三個月尚無任何留言
最新文章
贏到請飲野 lol
[VB.Net] 中國象棋
[.Net] Classes / Imp...
[轉][API]4個keybd 模...
[VB2010]常玩的, 接水...
文章分類
全部 (32)
API (5)
雜談 (2)
DataBase (2)
M$ (9)
php (1)
VB.Net (5)
純粹搞笑 (4)
網頁 (5)
未分類 (1)
日誌統計
文章總數: 32
留言總數: 28
今日人氣: 3
累積人氣: 1909