窗口下的锁定很容易被解锁,想用DLL,不知如何实现,看下例DLL
LRESULT CALLBACK CallMouseProc (int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode>=0) 
{ if(wParam==WM_LBUTTONUP||wParam==WM_LBUTTONDOWN||wParam==WM_LBUTTONDBLCLK)
{
LPMOUSEHOOKSTRUCT pMouseHook=(MOUSEHOOKSTRUCT FAR *) lParam; char title[256]={0};
::GetWindowText(MainDialog,title,256);
         if(stricmp(title,"AABBCC")!=0)//是不是我的窗口名
return -1L;


}
} return CallNextHookEx(g_hhookMouse,nCode,wParam,lParam) ;}

解决方案 »

  1.   

    The SetCursorPos function moves the cursor to the specified screen coordinates. If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function, the system automatically adjusts the coordinates so that the cursor stays within the rectangle. BOOL SetCursorPos(
      int X,  // horizontal position
      int Y   // vertical position
    );
      

  2.   

    直接用:CRect rect(10,10,10,10);
    ClipCursor(&rect);就可以锁定鼠标了。