Ghost
Ghost

Reputation: 1835

How do i detect arrow keys in an mfc application?

How can i detect an arrow key when it's pressed? Is a particular message sent for each arrow key?

Upvotes: 2

Views: 3987

Answers (1)

Rost
Rost

Reputation: 9089

Use CWnd::OnKeyDown and CWnd::OnKeyUp handlers for WM_KEYDOWN/WM_KEYUP Windows messages and check nChar parameter for virtual key codes VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN.

Upvotes: 4

Related Questions