Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  212
Language: C/C++
Code:
using System.Runtime.InteropServices;
 
namespace MOUSE
{
    public partial class Form1 : Form
    {
 
        [DllImport("user32.dll", SetLastError = true)]
        public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo);
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button5_Click(object sender, EventArgs e)
        {
            int u = -120; //крок прокрутки якщо додатнє то в гору, відємне то в низ
            mouse_event((uint)MouseEventFlags.MouseWheel, 0, 0, unchecked((uint)u), 0);
        }
    }
    [Flags]
    public enum MouseEventFlags
    {
        LeftDown = 0x00000002,
        LeftUp = 0x00000004,
        MiddleDown = 0x00000020,
        MiddleUp = 0x00000040,
        Move = 0x00000001,
        Absolute = 0x00008000,
        RightDown = 0x00000008,
        RightUp = 0x00000010,
        MouseWheel = 0x0800
    }
}
Comments: