Interfacing
Signal translated to ASCII Message sent to window and to Caret Key pressed Kernel get it Signal translated to ASCII Message sent to window and to Caret
Cursor vs Caret Cursor – graphical image to indicate position Caret – flashing object for text input
Keys messages WM_KEYDOWN WM_KEYUP LPARAM bits Meaning 0-15 Times a key was pressed 16-23 Key code 29 Context code 30 Previous key state 31 Transition state
Caret System provides one caret per message queue (read more about message queue) Window creates a caret only when it has the keyboard focus or is active Only one active caret at the moment! WM_SETFOCUS WM_KILLFOCUS
Cursor (mouse) Mouse can send a lot of messages. In addition LPARAM and WPARAM variables stores additional information.
Mouse messages (standart) WM_LBUTTONDBLCLK WM_LBUTTONDPWN WM_LBUTTONUP WM_MBUTTONDOWN WM_MBUTTONUP WM_MOUSEMOVE WM_MOUSEWHEEL WM_RBUTTONDOWN WM_BUTTONUP
LPARAM stores information about X-Y coordinates, and WPARAM – SHIFT and CTRL state. System provides support for mouse tracking, but program can interfere into mouse movement or messages sent.
Timer Used to interrupt program’s workflow Message queue Though timer isn’t input device, but it can send input messages to window, thus it can be considered as one. Native timer’s time function isn’t accurate enough to use with games or time response (DirectX API)
How to use? SetTimer – create a timer KillTimer – destroys a timer WM_TIMER – message sent to window after the set time is run out
Two ways... It is possible to process WM_TIMER message inside window procedure It is possible to define feedback function TimerProc to process message
TimerProc
Timer message(s) Timer sends only one message – WM_TIMER Variable WPARAM keeps timers ID