Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture Two Event Handling Keyboard and Mouse Input.

Similar presentations


Presentation on theme: "Lecture Two Event Handling Keyboard and Mouse Input."— Presentation transcript:

1 Lecture Two Event Handling Keyboard and Mouse Input

2 Contents  Debug Technique  Message Mapping in MFC  Keyboard Msg  Mouse Msg  Other MSGs  MessageBox

3 Debug Technique  BreakPoint  afxDump  TRACE  Debug Window

4 Message Mapping in MFC  Detects event  Determines which window get that event  OS calls WndProc  WndProc determines type of event/message  Function in turn takes care of the event

5 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, UINT nFlags)  OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)

6 Mouse Msg  Mouse Event  Mouse click, movement  Mouse wheel  SetCapture, ReleaseCapture

7 Other MSGs  WM_PAINT  WM_TIMER  WM_SIZE  WM_CREATE  WM_DESTROY

8 MessageBox  Small Dialog Box notify user simple message  AfxMessageBox( LPCTSTR lpszText, UINT nType = MB_OK, UINT nIDHelp = 0 );  int CWnd::MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );


Download ppt "Lecture Two Event Handling Keyboard and Mouse Input."

Similar presentations


Ads by Google