Docsity

Keyboard and Mouse Input in Windows: Messages, Timers, and Functions, Slides of Windows Programming

Partial preview of the text

Download Keyboard and Mouse Input in Windows: Messages, Timers, and Functions and more Slides Windows Programming in PDF only on Docsity!

LL e c te c t u ru r ee

Review of Last Lecture

getch();

Keyboard Input

Extended Keyboard Characters

Keyboard Input

Status Polling

vs

Message Driven Programming

WM_KEYDOWN
WM_KEYUP
WM_SYSKEYDOWN
WM_SYSKEYUP

Keyboard Messages

Combinations of keys with ALT

generate WM_SYSKEYDOWN

Character Messages
Keystroke Messages

Keyboard Messages

WM_KEYDOWN

WM_KEYDOWN

WM_KEYUP

WM_KEYUP

Initial State

(Shift Pressed)

(W Pressed)

(W Released)

(Shift Released)

Keystroke Messages Format WM_KEYDOWN WM_KEYUP WM_SYSKEYDOWN WM_SYSKEYUP

wParam: Virtual-key code

lParam: Additional message information

WINUSER.H identifier

wParam Keyboard key

91 92 93

VK_LWIN VK_RWIN VK_APPS

Left Windows key Right Windows key Application key

Virtual-key codes for Windows keys

lParam of WM_KEYDOWN

Bits

0 - 15 16 - 23 24

Repeat count Scan code 1, if an Extended Key 0, otherwise

Extended Keys were not part of the standard IBM keyboard. These appeared on IBM 101- and 102-keys Enhanced Keyboards later.

WM_KEYDOWN

WM_KEYDOWN

WM_KEYUP

WM_KEYUP

Initial State

(Ctrl Pressed)

(F Pressed)

(F Released)

(Ctrl Released)

GetKeyState()

SHORT GetKeyState(

int nVirtKey virtual-key code

);