Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interfacing.

Similar presentations


Presentation on theme: "Interfacing."— Presentation transcript:

1 Interfacing

2 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

3 Cursor vs Caret Cursor – graphical image to indicate position
Caret – flashing object for text input

4 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

5 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

6 Cursor (mouse) Mouse can send a lot of messages. In addition LPARAM and WPARAM variables stores additional information.

7 Mouse messages (standart)
WM_LBUTTONDBLCLK WM_LBUTTONDPWN WM_LBUTTONUP WM_MBUTTONDOWN WM_MBUTTONUP WM_MOUSEMOVE WM_MOUSEWHEEL WM_RBUTTONDOWN WM_BUTTONUP

8 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.

9 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)

10 How to use? SetTimer – create a timer KillTimer – destroys a timer
WM_TIMER – message sent to window after the set time is run out

11

12 Two ways... It is possible to process WM_TIMER message inside window procedure It is possible to define feedback function TimerProc to process message

13

14 TimerProc

15 Timer message(s) Timer sends only one message – WM_TIMER
Variable WPARAM keeps timers ID


Download ppt "Interfacing."

Similar presentations


Ads by Google