1
|
afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ); |
Specifies the virtual key code of the given key. For a list of of standard virtual key codes, see Winuser.h
Repeat count (the number of times the keystroke is repeated as a result of the user holding down the key).
Specifies the scan code, key-transition code, previous key state, and context code, as shown in the following list:
- nChar : 가상 키 코드 [MSDN link : virtual key codes ]
- nRepCnt : 반복 횟수
- nFlags : 각종 정보들..(당장은 몰라도 된다)
가상 키 코드는 키보드에 있는 각 키들의 정보를 가지고 있다.
눌려진 키를 알고싶으면 CString temp = "";temp.Format("%c", nChar);
어떤 경우에 쓰나?
→ 원하는 View 나 Dialog에서 특정 키 입력에 대한 처리를 해야하는경우ex) 로그인 창에 enter키 입력, 게임화면에 특수키 설정( 스타에 F10같은 키 처리) 등등..
이걸로 다양한 키입력 처리를 해보자!! :D
출처 : http://hatti.tistory.com/23
'컴퓨터 > 언어,프로그래밍' 카테고리의 다른 글
[MSDN] Virtual-Key Codes (가상키코드) (0) | 2011.12.24 |
---|---|
[MFC Dialog] PreTranslateMessage (0) | 2011.12.24 |
[VC++] MFC 기본 요점 정리 (0) | 2011.12.24 |
[VC++] SetTimer()함수, KillTimer()함수 (0) | 2011.12.24 |
MFC Timer (SetTimer,OnTimer,KillTimer,ON_WM_TIMER) (0) | 2011.12.24 |