VC++ 获取鼠标坐标

2024-11-25 23:23:52
推荐回答(4个)
回答1:

case WM_LBUTTONDOWN:
x=LOWORD(lParam);
y=HIWORD(lParam);
break;

回答2:

HDC dc;
POINT point;//应该放在switch前面
....
case WM_LBUTTONDOWN:
dc=GetDC(hwnd);
GetCursorPos(&point); //鼠标位置
dc.TextOut(...);
ReleaseDC(hwnd,dc);

回答3:

case WM_LBUTTONDOWN:
mouse_x=LOWORD(lParam);
mouse_y=HIWORD(lParam);
sprintf(str,"%d,%d",mouse_x,mouse_y);//显示坐标
TextOut(cdc,20,20,str,strlen(str));
break;

回答4:

POINT point;
GetCursorPos(&point); //鼠标位置
cout<<(<