2009년 03월 03일
[MFC] Ctrl 과 Shift 클릭여부
다음과 같이 간단하게 사용할수 있다.
#define IsSHIFTpressed() ( (GetKeyState(VK_SHIFT) & (1 << (sizeof(SHORT)*8-1))) != 0 )
#define IsCTRLpressed() ( (GetKeyState(VK_CONTROL) & (1 << (sizeof(SHORT)*8-1))) != 0 )
GetKeyState() Return Value
The return value specifies the status of the specified virtual key, as follows:
- If the high-order bit is 1, the key is down; otherwise, it is up.
- If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.
그동안 이런경우.. Ctrl이 눌리면 멤버 Bool값을 true로하여 그값과 조합으로 Ctrl+c 같은 키 이벤트를 처리했었다..
모르면 몸이 피곤하다.
이 글과 관련있는 글을 자동검색한 결과입니다 [?]
- 말이 필요없다는....... ㅠㅠb by 사월
- 이클립스의 유용한 단축키 ㅠㅠ by ☆犬夜叉☆
- 익스플로러 빠르게 사용하는 단축키. by airen
- 포토샵 처음 설치한 상태로 되돌리기 by airen
- Shift의 오묘함 by 시즈하
# by | 2009/03/03 12:53 | C++/MFC | 트랙백 | 덧글(2)






☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
BOOL bControlKey = (0x8000 == (0x8000 & GetKeyState(VK_CONTROL)));
BOOL bShiftKey = (0x8000 == (0x8000 & GetKeyState(VK_SHIFT)));
복잡하게 쉬프트연산 안쓰셔도 됩니다.
수학은 예전엔 잘했다고 생각했는데 영 안되네요 ㅎ