示例#1
0
 public void SendMouseWheel(int deltaY, Viewer viewer)
 {
     TryOnInputDesktop(() =>
     {
         if (deltaY < 0)
         {
             deltaY = -120;
         }
         else if (deltaY > 0)
         {
             deltaY = 120;
         }
         var union = new User32.InputUnion()
         {
             mi = new User32.MOUSEINPUT()
             {
                 dwFlags = MOUSEEVENTF.WHEEL, dx = 0, dy = 0, time = 0, mouseData = deltaY, dwExtraInfo = GetMessageExtraInfo()
             }
         };
         var input = new User32.INPUT()
         {
             type = InputType.MOUSE, U = union
         };
         SendInput(1, new User32.INPUT[] { input }, INPUT.Size);
     });
 }
示例#2
0
        public uint SendMouseWheel(int deltaY, Viewer viewer)
        {
            Win32Interop.SwitchToInputDesktop();
            if (deltaY < 0)
            {
                deltaY = -120;
            }
            else if (deltaY > 0)
            {
                deltaY = 120;
            }
            var union = new User32.InputUnion()
            {
                mi = new User32.MOUSEINPUT()
                {
                    dwFlags = MOUSEEVENTF.WHEEL, dx = 0, dy = 0, time = 0, mouseData = deltaY, dwExtraInfo = GetMessageExtraInfo()
                }
            };
            var input = new User32.INPUT()
            {
                type = InputType.MOUSE, U = union
            };

            return(SendInput(1, new User32.INPUT[] { input }, INPUT.Size));
        }