3_f01 - More Win32 API More Mouse Stuff GetSystemMetrics()...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 More Win32 API l More Mouse Stuff l GetSystemMetrics() l WM_PAINT Messages l GetClientRect() l TextOut() l wsprintf() l Using Fonts l GetTextMetrics() l Example Program Mouse Messages l Client Area Mouse Messages— – Mouse msgs generated when mouse moves over the window’s client area – or when pressed/released within window’s client area – 21 messages in all – WM_MOUSEMOVE: Sent to window under cursor when mouse moved • lParam = mouse cursor X,Y position • wParam: Mouse notification code – MK_LBUTTON, MK_RBUTTON, MK_SHIFT, MK_CONTROL l WM_*BUTTON# : l * = L, M, R l # = DOWN, UP, DBLCLK l DBLCLK message sent only if wndclass.style contains CS_DBLCLKS Input Focus l Window whose caption line is highlighted has "input focus" l Only this window will receive keyboard input l Run 2 instances of Winapp2 Note: keyboard accelerators only work with instance that has input focus l Input focus not significant for mouse input l Good since mouse is used to activate a window l When a window gains (loses) input focus: WM_SETFOCUS (WM_KILLFOCUS) message sent to window l Common responses: highlight an edit area, change a caption, etc. l SetFocus(hWnd) Give a window (or a control) the input focus l Response to receiving input focus depends on window style l Mouse actions in other parts of window L WM_NC* messages sent (* = MOUSEMOVE, etc.) wParam: HT* hit test code non-client area where action occurred lParam: mouse cursor position Usually not processed by applications Could use to generate other messages e.g., WM_NCLBUTTONDOWN + coordinates WM_COMMAND Nonclient Area Mouse Messages
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

3_f01 - More Win32 API More Mouse Stuff GetSystemMetrics()...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online