質問編集履歴

3

Win32APIを追加

2019/01/26 01:03

投稿

torisan
torisan

スコア678

test CHANGED
File without changes
test CHANGED
File without changes

2

タイトル変更・VB6の記述追加

2019/01/26 01:03

投稿

torisan
torisan

スコア678

test CHANGED
@@ -1 +1 @@
1
- キーボードの値を取得(getkeyboardstate)
1
+ Rubyでキーボードの値を取得(getkeyboardstate)
test CHANGED
@@ -97,3 +97,31 @@
97
97
 
98
98
 
99
99
  以上、よろしくお願いいたします。
100
+
101
+
102
+
103
+ ----------------------------------------------------------
104
+
105
+ 追記:2019/01/24 11:28
106
+
107
+ VB6で上記と同様と思われるプログラムを作成しました。
108
+
109
+ こちらは正常に動作します。(返り値に1が返る)
110
+
111
+ ```VB6
112
+
113
+ Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
114
+
115
+
116
+
117
+ Private Sub Form_Activate()
118
+
119
+ Dim state(255) As Byte
120
+
121
+ Label1.Caption = GetKeyboardState(state(0)) 'GetKeyboardStateの返り値(1 固定)
122
+
123
+ Label2.Caption = state(90) 'zキーを押した結果(0=>129=>1=>128=>0...)
124
+
125
+ End Sub
126
+
127
+ ```

1

試したみた事③の結果を修正

2019/01/24 02:28

投稿

torisan
torisan

スコア678

test CHANGED
File without changes
test CHANGED
@@ -52,7 +52,7 @@
52
52
 
53
53
  ③@getkeyboardstate.call(@getkey[0])を@getkeyboardstate.call(@getkey)に
54
54
 
55
- 特に変化なし
55
+ タイプエラー(can't convert Array into String)
56
56
 
57
57
  ④Win32API.new('user32', 'GetKeyboardState', 'i', 'i')の『'』を『"』にする
58
58