掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
OS上の全てのキーボードイベントを拾うには? (ID:117683)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
もう見ていないかもだけど、 ループで回してもCPU使用率1%以下でしたよ。 Private Declare Function GetKeyState Lib "User32.dll" (ByVal Key As Integer) As Long Private Declare Function timeGetTime Lib "winmm.dll" () As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Dim StopFlag As Boolean Private Sub Form_Load() Show Call TimeCount End Sub Private Sub TimeCount() Static timeFlag As Boolean Static startTime As Long Static endTime As Long Do If (GetKeyState(&H7A) < 0) Then If timeFlag = False Then startTime = timeGetTime End If timeFlag = True Else If timeFlag Then endTime = timeGetTime MsgBox endTime - startTime & " mSec押下" End If timeFlag = False End If DoEvents Call Sleep(1) DoEvents Loop Until StopFlag End Sub Private Sub Form_Unload(Cancel As Integer) StopFlag = True End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.