lecture two event handling keyboard and mouse input
TRANSCRIPT
Lecture Two
Event Handling
Keyboard and Mouse Input
Contents Debug Technique Message Mapping in MFC Keyboard Msg Mouse Msg Other MSGs MessageBox
Debug Technique BreakPoint afxDump TRACE Debug Window
Message Mapping in MFC Detects event Determines which window get that event OS calls WndProc WndProc determines type of event/mes
sage Function in turn takes care of the event
Keyboard Msg Handle all Keyboard event Method to add event handler for a window OnChar(UINT nChar, UINT nRepCnt, UINT
nFlags) OnKeyDown(UINT nChar, UINT nRepCnt, U
INT nFlags) OnKeyUp(UINT nChar, UINT nRepCnt, UIN
T nFlags)
Mouse Msg Mouse Event Mouse click, movement Mouse wheel SetCapture, ReleaseCapture
Other MSGs WM_PAINT WM_TIMER WM_SIZE WM_CREATE WM_DESTROY
MessageBox Small Dialog Box notify user simple messag
e AfxMessageBox( LPCTSTR lpszText, UINT nType = MB_OK, UINT nIDHelp = 0 );
int CWnd::MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );