利用WINAPI BOOL GetCursorPos( LPPOINT lpPoint // 鼠标坐标,相对于屏幕的); 使用方法 POINT pt; if (GetCursorPos(&pt)) { ... }
GetCursorPos The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos( LPPOINT lpPoint // address of structure for cursor position );
GetCursorPos The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos( LPPOINT lpPoint // address of structure for cursor position );
BOOL GetCursorPos(
LPPOINT lpPoint // 鼠标坐标,相对于屏幕的);
使用方法
POINT pt;
if (GetCursorPos(&pt))
{
...
}
The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos(
LPPOINT lpPoint // address of structure for cursor position
);
The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos(
LPPOINT lpPoint // address of structure for cursor position
);
void CMyView::OnLButtonDown(UINT nFlag, CPoint point)
{
//.....
SetCapture();
SetCursor(LoadCursor(NULL,IDC_CROSS));
//....
}
void CMyView::OnLButtonDblClk(UINT nFlag, CPoint point)
{
//....
CString InfoString;
InfoString.Format("X:%d Y:%d,point.x,point.y");
MessageBox(InfoString);
//...
}
BOOL GetCursorPos(
LPPOINT lpPoint // 鼠标坐标,相对于屏幕的);
使用方法
POINT pt;
if (GetCursorPos(&pt))
{
...
}
GetCursorPos(&pt);
ScreenToClient();