본문 바로가기

컴퓨터/언어,프로그래밍

[MFC Dialog] OnKeyDown message

1
afx_msg void OnKeyDown(   UINT nChar,   UINT nRepCnt,   UINT nFlags );

nChar

Specifies the virtual key code of the given key. For a list of of standard virtual key codes, see Winuser.h

nRepCnt

Repeat count (the number of times the keystroke is repeated as a result of the user holding down the key).

nFlags

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
제주삼다수, 2L,... 오뚜기 진라면 매운... 상하목장 유기농 흰... 남양 프렌치카페 카... 고려인삼유통 홍삼 ... 종근당건강 오메가3... 요이치 카링 유무선...