kyuseo의 게임 프로그래밍

마우스 메시지 WM_MOVE / WM_LBUTTONDOWN 의 버그 / 오류 / 문제점 본문

C++ 개발

마우스 메시지 WM_MOVE / WM_LBUTTONDOWN 의 버그 / 오류 / 문제점

kyuseo 2008. 3. 11. 19:16

개요..

 

마우스 메시지 WM_MOVE / WM_LBUTTONDOWN 의 버그 / 오류 / 문제점을 알려드립니다.

 

 

오류 내용

 

MSDN 에는 아래와 같이 기술되어있지만 실제로는

 

WM_MOVE xPos = (int)LOWORD(lParam); yPos = (int)HIWORD(lParam);

->

WM_MOVE xPos = (short)LOWORD(lParam); yPos = (short)HIWORD(lParam);

 

으로 해야 합니다. 왜냐하면 음수(-) 값 처리를 하기 위해서는 WORD 형을 INT 형으로 변환할 시 올바르게 변환이 되지 않으므로SHORT 형으로 변환하여야 합니다.

 

 

위와 유사한 메시지 목록

 

#define WM_MOUSEMOVE 0x0200

#define WM_LBUTTONDOWN 0x0201

#define WM_LBUTTONUP 0x0202

#define WM_LBUTTONDBLCLK 0x0203

#define WM_RBUTTONDOWN 0x0204

#define WM_RBUTTONUP 0x0205

#define WM_RBUTTONDBLCLK 0x0206

#define WM_MBUTTONDOWN 0x0207

#define WM_MBUTTONUP 0x0208

#define WM_MBUTTONDBLCLK 0x0209

 

 

참고 MSDN 원문

 

WM_MOVE

This message is sent after a window has been moved.

 

WM_MOVE xPos = (int)LOWORD(lParam); yPos = (int)HIWORD(lParam);

Parameters

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the upper-left corner of the client area of the window.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the upper-left corner of the client area of the window.

Return Values

An application should return zero if it processes this message.

 

Remarks

The xPos and yPos Parameters are given in screen coordinates for overlapped and pop-up windows and in parent-client coordinates for child windows.

 

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

 

Requirements

 

Runs on Versions Defined in Include Link to

Windows CE OS 1.0 and later Winuser.h

 

 

 

Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

 

See Also

POINTS