PB 4.61, Win7 Home Premium x64, deutsches Tastaturenlayout (QWERTZ)
Wenn man KeyboardMode(#PB_Keyboard_International | #PB_Keyboard_AllowSystemKeys) benutzt, dann wird die Flag #PB_Keyboard_International ignoriert, aber #PB_Keyboard_AllowSystemKeys arbeitet (generell) wie erwartet.
Code: Alles auswählen
Global Dim c(5)
c(0) = $0000FF
c(5) = $FF0000
Dim Key$(255) ;{
Key$(#PB_Key_1 ) = "2 = #PB_Key_1"
Key$(#PB_Key_2 ) = "3 = #PB_Key_2"
Key$(#PB_Key_3 ) = "4 = #PB_Key_3"
Key$(#PB_Key_4 ) = "5 = #PB_Key_4"
Key$(#PB_Key_5 ) = "6 = #PB_Key_5"
Key$(#PB_Key_6 ) = "7 = #PB_Key_6"
Key$(#PB_Key_7 ) = "8 = #PB_Key_7"
Key$(#PB_Key_8 ) = "9 = #PB_Key_8"
Key$(#PB_Key_9 ) = "10 = #PB_Key_9"
Key$(#PB_Key_0 ) = "11 = #PB_Key_0"
Key$(#PB_Key_A ) = "30 = #PB_Key_A"
Key$(#PB_Key_B ) = "48 = #PB_Key_B"
Key$(#PB_Key_C ) = "46 = #PB_Key_C"
Key$(#PB_Key_D ) = "32 = #PB_Key_D"
Key$(#PB_Key_E ) = "18 = #PB_Key_E"
Key$(#PB_Key_F ) = "33 = #PB_Key_F"
Key$(#PB_Key_G ) = "34 = #PB_Key_G"
Key$(#PB_Key_H ) = "35 = #PB_Key_H"
Key$(#PB_Key_I ) = "23 = #PB_Key_I"
Key$(#PB_Key_J ) = "36 = #PB_Key_J"
Key$(#PB_Key_K ) = "37 = #PB_Key_K"
Key$(#PB_Key_L ) = "38 = #PB_Key_L"
Key$(#PB_Key_M ) = "50 = #PB_Key_M"
Key$(#PB_Key_N ) = "49 = #PB_Key_N"
Key$(#PB_Key_O ) = "24 = #PB_Key_O"
Key$(#PB_Key_P ) = "25 = #PB_Key_P"
Key$(#PB_Key_Q ) = "16 = #PB_Key_Q"
Key$(#PB_Key_R ) = "19 = #PB_Key_R"
Key$(#PB_Key_S ) = "31 = #PB_Key_S"
Key$(#PB_Key_T ) = "20 = #PB_Key_T"
Key$(#PB_Key_U ) = "22 = #PB_Key_U"
Key$(#PB_Key_V ) = "47 = #PB_Key_V"
Key$(#PB_Key_W ) = "17 = #PB_Key_W"
Key$(#PB_Key_X ) = "45 = #PB_Key_X"
Key$(#PB_Key_Y ) = "21 = #PB_Key_Y"
Key$(#PB_Key_Z ) = "44 = #PB_Key_Z"
Key$(#PB_Key_Escape ) = "1 = #PB_Key_Escape"
Key$(#PB_Key_Minus ) = "12 = #PB_Key_Minus"
Key$(#PB_Key_Equals ) = "13 = #PB_Key_Equals"
Key$(#PB_Key_Back ) = "14 = #PB_Key_Back"
Key$(#PB_Key_Tab ) = "15 = #PB_Key_Tab"
Key$(#PB_Key_LeftBracket ) = "26 = #PB_Key_LeftBracket"
Key$(#PB_Key_RightBracket) = "27 = #PB_Key_RightBracket"
Key$(#PB_Key_Return ) = "28 = #PB_Key_Return"
Key$(#PB_Key_LeftControl ) = "29 = #PB_Key_LeftControl"
Key$(#PB_Key_SemiColon ) = "39 = #PB_Key_SemiColon"
Key$(#PB_Key_Apostrophe ) = "40 = #PB_Key_Apostrophe"
Key$(#PB_Key_Grave ) = "41 = #PB_Key_Grave"
Key$(#PB_Key_LeftShift ) = "42 = #PB_Key_LeftShift"
Key$(#PB_Key_BackSlash ) = "43 = #PB_Key_BackSlash"
Key$(#PB_Key_Comma ) = "51 = #PB_Key_Comma"
Key$(#PB_Key_Period ) = "52 = #PB_Key_Period"
Key$(#PB_Key_Slash ) = "53 = #PB_Key_Slash"
Key$(#PB_Key_RightShift ) = "54 = #PB_Key_RightShift"
Key$(#PB_Key_Multiply ) = "55 = #PB_Key_Multiply"
Key$(#PB_Key_LeftAlt ) = "56 = #PB_Key_LeftAlt"
Key$(#PB_Key_Space ) = "57 = #PB_Key_Space"
Key$(#PB_Key_Capital ) = "58 = #PB_Key_Capital"
Key$(#PB_Key_F1 ) = "59 = #PB_Key_F1"
Key$(#PB_Key_F2 ) = "60 = #PB_Key_F2"
Key$(#PB_Key_F3 ) = "61 = #PB_Key_F3"
Key$(#PB_Key_F4 ) = "62 = #PB_Key_F4"
Key$(#PB_Key_F5 ) = "63 = #PB_Key_F5"
Key$(#PB_Key_F6 ) = "64 = #PB_Key_F6"
Key$(#PB_Key_F7 ) = "65 = #PB_Key_F7"
Key$(#PB_Key_F8 ) = "66 = #PB_Key_F8"
Key$(#PB_Key_F9 ) = "67 = #PB_Key_F9"
Key$(#PB_Key_F10 ) = "68 = #PB_Key_F10"
Key$(#PB_Key_F11 ) = "87 = #PB_Key_F11"
Key$(#PB_Key_F12 ) = "88 = #PB_Key_F12"
Key$(#PB_Key_NumLock ) = "69 = #PB_Key_NumLock"
Key$(#PB_Key_Scroll ) = "70 = #PB_Key_Scroll"
Key$(#PB_Key_Pad0 ) = "82 = #PB_Key_Pad0"
Key$(#PB_Key_Pad1 ) = "79 = #PB_Key_Pad1"
Key$(#PB_Key_Pad2 ) = "80 = #PB_Key_Pad2"
Key$(#PB_Key_Pad3 ) = "81 = #PB_Key_Pad3"
Key$(#PB_Key_Pad4 ) = "75 = #PB_Key_Pad4"
Key$(#PB_Key_Pad5 ) = "76 = #PB_Key_Pad5"
Key$(#PB_Key_Pad6 ) = "77 = #PB_Key_Pad6"
Key$(#PB_Key_Pad7 ) = "71 = #PB_Key_Pad7"
Key$(#PB_Key_Pad8 ) = "72 = #PB_Key_Pad8"
Key$(#PB_Key_Pad9 ) = "73 = #PB_Key_Pad9"
Key$(#PB_Key_Add ) = "78 = #PB_Key_Add"
Key$(#PB_Key_Subtract ) = "74 = #PB_Key_Subtract"
Key$(#PB_Key_Decimal ) = "83 = #PB_Key_Decimal"
Key$(#PB_Key_PadEnter ) = "156 = #PB_Key_PadEnter"
Key$(#PB_Key_RightControl) = "157 = #PB_Key_RightControl"
Key$(#PB_Key_PadComma ) = "179 = #PB_Key_PadComma"
Key$(#PB_Key_Divide ) = "181 = #PB_Key_Divide"
Key$(#PB_Key_RightAlt ) = "184 = #PB_Key_RightAlt"
Key$(#PB_Key_Pause ) = "197 = #PB_Key_Pause"
Key$(#PB_Key_Home ) = "199 = #PB_Key_Home"
Key$(#PB_Key_Up ) = "200 = #PB_Key_Up"
Key$(#PB_Key_Down ) = "208 = #PB_Key_Down"
Key$(#PB_Key_Left ) = "203 = #PB_Key_Left"
Key$(#PB_Key_Right ) = "205 = #PB_Key_Right"
Key$(#PB_Key_End ) = "207 = #PB_Key_End"
Key$(#PB_Key_PageUp ) = "201 = #PB_Key_PageUp"
Key$(#PB_Key_PageDown ) = "209 = #PB_Key_PageDown"
Key$(#PB_Key_Insert ) = "210 = #PB_Key_Insert"
Key$(#PB_Key_Delete ) = "211 = #PB_Key_Delete"
For i = 0 To 255
If Key$(i) = #NUL$
Key$(i) = Str(i)+" = [undefined]"
EndIf
Next ;}
Procedure MyChangeKeyboardMode(Flags)
For i = 1 To 4
c(i) = $888888
Next
KeyboardMode(Flags)
Select Flags
Case #PB_Keyboard_Qwerty
c(1) = $00FF00
Case #PB_Keyboard_International
c(2) = $00FF00
Case #PB_Keyboard_Qwerty | #PB_Keyboard_AllowSystemKeys
c(3) = $00FF00
Case #PB_Keyboard_International | #PB_Keyboard_AllowSystemKeys
c(4) = $00FF00
EndSelect
EndProcedure
If InitSprite() And InitKeyboard() And OpenWindow(0,0,0,640,480,"bla") And OpenWindowedScreen(WindowID(0),0,0,WindowWidth(0),WindowWidth(0),0,0,0)
MyChangeKeyboardMode(#PB_Keyboard_Qwerty)
Repeat
FlipBuffers() : While WindowEvent() : Wend
If ExamineKeyboard()
If KeyboardReleased(#PB_Key_F1) : MyChangeKeyboardMode(#PB_Keyboard_Qwerty) : EndIf
If KeyboardReleased(#PB_Key_F2) : MyChangeKeyboardMode(#PB_Keyboard_International) : EndIf
If KeyboardReleased(#PB_Key_F3) : MyChangeKeyboardMode(#PB_Keyboard_Qwerty | #PB_Keyboard_AllowSystemKeys) : EndIf
If KeyboardReleased(#PB_Key_F4) : MyChangeKeyboardMode(#PB_Keyboard_International | #PB_Keyboard_AllowSystemKeys) : EndIf
If KeyboardReleased(#PB_Key_Escape) : End : EndIf
For i = 0 To 255
If KeyboardPushed(i)
ScanCode = i
Break
EndIf
Next i
EndIf
ClearScreen(0)
If StartDrawing(ScreenOutput())
DrawText(0, 0, "ESC = Quit", c(0))
DrawText(0, 30, "F1 = #PB_Keyboard_Qwerty", c(1))
DrawText(0, 60, "F2 = #PB_Keyboard_International", c(2))
DrawText(0, 90, "F3 = #PB_Keyboard_Qwerty | #PB_Keyboard_AllowSystemKeys", c(3))
DrawText(0,120, "F4 = #PB_Keyboard_International | #PB_Keyboard_AllowSystemKeys", c(4))
DrawText(0,150, "last scan code = "+Key$(ScanCode), c(5))
StopDrawing()
EndIf
ForEver
Else
MessageRequester("ERROR", "ERROR")
EndIf