C# 오토 마우스 매크로 소스코드
C# 매크로 오토마우스 프로그램 소스코드
using System.Runtime.InteropServices;
namespace WinFormsApp1
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Autoclicker_Tick(object sender, EventArgs e)
{
/*
if (!Bounds.Contains(PointToClient(MousePosition)))
{
mouse_event(0x02, 0, 0, 0, 0);
Systehttp://m.Threading.Thread.Sleep(10);
mouse_event(0x04, 0, 0, 0, 0);
}
*/
Point p = Cursor.Position;
label_mouse.Text = p.X + " " + p.Y;
mouse_event(0x02, 437, 437, 0, 0);
Systehttp://m.Threading.Thread.Sleep(10);
mouse_event(0x04, 437, 437, 0, 0);
}
private void StartAutoclick()
{
Autoclicker.Interval = (int)(1000.0 / CPSbar.Value);
Autoclicker.Start();
buttonStart.Enabled = false;
buttonStop.Enabled = true;
}
private void StopAutoclick()
{
Autoclicker.Stop();
buttonStart.Enabled = true;
buttonStop.Enabled = false;
}
private void buttonStart_Click(object sender, EventArgs e)
{
StartAutoclick();
}
private void buttonStop_Click(object sender, EventArgs e)
{
StopAutoclick();
}
private void CPSbar_Scroll(object sender, ScrollEventArgs e)
{
CPStext.Text = CPSbar.Value.ToString();
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}