VB6 - 呢句野做緊乜

2010-06-05 7:24 pm
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function

紅字呢句野既 「<」 其實係做緊乜
更新1:

介唔介意我問多個問題 :: 用返呢舊野做例 If MyHotKey(vbKeyA) then (......) 呢一個If 之中無運算子 只係得MyHotKey(vbKeyA) 係咪講緊 Boolean = True 略左=True 呢part 默認左??

回答 (1)

2010-06-05 7:36 pm
✔ 最佳答案
因為Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As
Long) As Integer
所以GetAsyncKeyState(vKeyCode)會得到Integer
“<”系比較個Integer是否小於0
比較的結果是 Boolean, 符合Private Function MyHotKey(vKeyCode) As Boolean

唔明可以再問^_^


收錄日期: 2021-04-25 23:57:12
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20100605000051KK00361

檢視 Wayback Machine 備份