Revision [20255]

This is an old revision of KeyPgGetkey made by DkLwikki on 2016-02-10 16:00:55.

 

GETKEY


Returns the ascii code of the first key in the keyboard buffer

Syntax:
declare function Getkey ( ) as long

Usage:
result = Getkey

Return Value:
The value of the ascii code returned.

Description:
It returns the ascii code of the first key in the keyboard buffer. The key is removed from the buffer. If no key is present, Getkey waits for it. For extended keys (returning two characters), the extended code is returned in the first byte, and the regular code is returned in the second byte. (see example below)
The key read is not echoed to the screen.
For a keyword not stopping the program if no key is at the buffer see Inkey or Multikey.

Examples:
Dim As Integer foo
Do
    foo = GetKey
    Print "total return: " & foo
   
    If( foo > 255 ) Then
        Print "extended code: " & (foo And &hff)
        Print "regular code: " & (foo Shr 8)
    Else
        Print "regular code: " & (foo)
    End If
    Print
Loop Until foo = 27



Dialect Differences:
Differences from QB:
See also:
Back to User Input
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode