會有標準的window callback function - WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
在這裡面
你可以加入滑鼠的message處理
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
case WM_LBUTTONDOWN:
break;
case WM_LBUTTONUP:
break;
case WM_MOUSEMOVE:
break;
}
如何得知滑鼠左鍵點下的座標位置呢
資訊就在lParam裡面
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
case WM_LBUTTONDOWN:
POINT pt;
pt.x = LOWORD(lParam); //滑鼠X坐標
pt.y = HIWORD(lParam); //滑鼠Y坐標
break;
case WM_LBUTTONUP:
break;
case WM_MOUSEMOVE:
break;
}
沒有留言:
張貼留言