コード例 #1
0
 void onMouseMove(object sender, llMouseEventArgs e)
 {
     if (MouseTrap != null)
     {
         bool     updated = false;
         position pos     = e.Position;
         if (pos.x < MouseTrap.Value.left)
         {
             updated = true;
             pos.x   = MouseTrap.Value.left;
         }
         else if (pos.x > MouseTrap.Value.right)
         {
             updated = true;
             pos.x   = MouseTrap.Value.right;
         }
         if (pos.y < MouseTrap.Value.top)
         {
             updated = true;
             pos.y   = MouseTrap.Value.top;
         }
         else if (pos.y > MouseTrap.Value.bottom)
         {
             updated = true;
             pos.y   = MouseTrap.Value.bottom;
         }
         if (updated)
         {
             llInputManager.MousePosition = pos;
             e.Handled = true;
         }
     }
 }
コード例 #2
0
 IntPtr mouseHookProc(int code, IntPtr wParam, ref mouseHookStruct lParam)
 {
     if (code >= 0)
     {
         if (0 == (lParam.flags & LLKHF_INJECTED))
         {
             llMouseEventArgs mea = new llMouseEventArgs(lParam.point);
             MouseMove(this, mea);
             if (mea.Handled)
             {
                 return((IntPtr)1);
             }
         }
         else
         {
             lParam.flags ^= LLKHF_INJECTED;
         }
     }
     return(NativeMethods.CallNextHook(mouseHook, code, wParam, ref lParam));
 }