RawKey()

语法

Result = RawKey()
概要
Returns the raw key code of the last Inkey() function call. It's useful for extended (non-ASCII) keys (for example, function keys, arrows, etc).

参数

无.

返回值

Returns the key code of the last pressed key.

Remarks

It is not only alphanumeric keys that have an ASCII value. The escape key (27), return key (13) tab key (9) and backspace key (8) are just four examples. A table with ASCII codes you find here.

示例

  If OpenConsole()
    PrintN("Press Escape to exit")
  
    Repeat
      KeyPressed$ = Inkey()
      
      If KeyPressed$ <> ""
        
        PrintN("You pressed: " + KeyPressed$)
        PrintN("It has a raw code of: "+Str(RawKey()))
        
      ElseIf RawKey()
      
        PrintN("You pressed a non ASCII key.")
        PrintN("It has a raw code of: "+Str(RawKey()))
        
      Else
        Delay(20) ; Don't eat all the CPU time, we're on a multitask OS
      EndIf
    
    Until KeyPressed$ = Chr(27) ; Wait until escape is pressed
  EndIf

参阅

Inkey(), Input()

已支持操作系统

Windows

<- PrintN() - Console Index - ReadConsoleData() ->