void CGggView::OnLButtonDown(UINT nFlags, CPoint point)
{
CRect rect;
GetClientRect(rect);
CPoint point1(rect.left,rect.top);
CClientDC dc(this);
dc.LPtoDP(&point1);
dc.SetWindowOrg(point1);
ClipCursor(&rect); }
我能不能这样子锁住鼠标于客户区里面? (用vc试过,不可以,,)
为什么不可以呢?
{
CRect rect;
GetClientRect(rect);
CPoint point1(rect.left,rect.top);
CClientDC dc(this);
dc.LPtoDP(&point1);
dc.SetWindowOrg(point1);
ClipCursor(&rect); }
我能不能这样子锁住鼠标于客户区里面? (用vc试过,不可以,,)
为什么不可以呢?
例子如下:
RECT rcClip; // new area for ClipCursor
RECT rcOldClip; // previous area for ClipCursor
// Record the area in which the cursor can move.
GetClipCursor(&rcOldClip);
// Get the dimensions of the application's window.
GetWindowRect(hwnd, &rcClip);
// Confine the cursor to the application's window.
ClipCursor(&rcClip); 这样就可以防止鼠标移到客户区外部了
WINSTA_WRITEATTRIBUTES access的权限
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
TRect ARect=BoundsRect;
int a=ClipCursor(&ARect);
}