结构MSG
如下:
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG;
消息流程如下:
long WINAPI WndProc(HWND hWnd, UINT iMessage, UINT wParam, LONG lParam)
我的问题:在消息过程中,为什么它不将POINT
变量传递给窗口过程,以及如何找到鼠标POINT
?由GetCursorPos()
? 我找到了一些LOWORD(lParam), HIWORD(lParam)
直接获取它的例子..你能告诉我有关它的信息吗?谢谢你...
我看到有人写这个,对吗?我不确定:
RECT rect1;
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam)
{
HDC hDC;
WORD x,y;
PAINTSTRUCT ps;
x = LOWORD(lParam);
y = HIWORD(lParam);
switch(iMessage)
{
case WM_LBUTTONDOWN:
if(wParam&MK_CONTROL)
{
rect1.left = x;
rect1.top = y;
}
else if(wParam&MK_SHIFT)
{
rect1.left = x;
rect1.top = y;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
return 0;
}