Ejemplo n.º 1
0
 internal static extern bool GetCursorPos( out PointStruct point );
Ejemplo n.º 2
0
 public bool Setup( IPluginSetupInfo info )
 {
     _lastPointerPosition = new PointStruct();
     return true;
 }
Ejemplo n.º 3
0
 private void GetCurrentPointerPos( object sender, EventArgs e )
 {
     PointStruct p;
     if( Win32Wrapper.GetCursorPos( out p ) )
     {
         if( ( _lastPointerPosition.X != p.X || _lastPointerPosition.Y != p.Y ) && InternalPointerMove != null )
         {
             _lastPointerPosition = p;
             InternalPointerMove( this, new PointerDeviceEventArgs( (int)_lastPointerPosition.X, (int)_lastPointerPosition.Y, new ButtonInfo(), "", InputSource.Unknown ) );
         }
     }
 }
Ejemplo n.º 4
0
 private void EnsurePositionRetrieval()
 {
     if( _pointerPositionViaTimer && _pointerPosGetter != null && !_pointerPosGetter.IsRunning )
     {
         PointStruct p;
         if( Win32Wrapper.GetCursorPos( out p ) )
         {
             _lastPointerPosition = p;
         }
     }
 }
Ejemplo n.º 5
0
 static void DoMovePointer( PointStruct p )
 {
     // Set cursor position to specified coordinates.
     Win32Wrapper.SetCursorPos( p.X, p.Y );
     // Throw a low level mouse move event to tell it to the world.
     Win32Wrapper.mouse_event( MouseEventFlags.MOVE, 0, 0, 0, 0 );
 }
Ejemplo n.º 6
0
        public bool Setup( IPluginSetupInfo info )
        {
            _lastPointerPosition = new PointStruct();

            //Versions above Vista unhook the mousehook as soon as there is a CPU overload. So we must use a simple timer to get the cursor position
            //We still use the mousehook to process the mouse clicks, which are less heavy to process
            //if( CK.Core.OSVersionInfo.OSLevel >= CK.Core.OSVersionInfo.SimpleOSLevel.WindowsVista )
            //{
            //    _pointerPositionViaTimer = true;
            //    _pointerPosGetter = new SimpleDispatchTimerWrapper( new TimeSpan( 150000 ), GetCurrentPointerPos );
            //}

            // We look if we can set the Low Level Mouse Hook
            string message;
            if( !WindowsHook.CanSetWindowsHook( HookType.WH_MOUSE_LL, out message ) )
            {
                info.FailedDetailedMessage = "Unable to set the MouseHook, This Driver may only run on Windows. Error: " + message;
                return false;
            }
            return true;
        }