using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Mixi
{
public partial class FrmTest : Mixi.FrmBase
{
[DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
[Flags]
public enum MouseEventFlags
{
LEFTDOWN = 0x00000002,
LEFTUP = 0x00000004,
MIDDLEDOWN = 0x00000020,
MIDDLEUP = 0x00000040,
MOVE = 0x00000001,
ABSOLUTE = 0x00008000,
RIGHTDOWN = 0x00000008,
RIGHTUP = 0x00000010
}
public static void LeftClick(int x, int y)
{
Cursor.Position = new System.Drawing.Point(x, y);
mouse_event((int)(MouseEventFlags.LEFTDOWN), 0, 0, 0, 0);
mouse_event((int)(MouseEventFlags.LEFTUP), 0, 0, 0, 0);
}
public FrmTest()
{
try
{
InitializeComponent();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
//Call the imported function with the cursor's current position
int X = Cursor.Position.X + 100;
int Y = Cursor.Position.Y + 10;
LeftClick(X, Y);
}
private void FrmTest_Load(object sender, EventArgs e)
{
}
private void FrmTest_KeyPress(object sender, KeyPressEventArgs e)
{
int X = Cursor.Position.X ;
int Y = Cursor.Position.Y ;
for(int i =0;i<10;i++)
{
Console.WriteLine("click");
textBox1.Text += i.ToString() + ";";
LeftClick(X + 20 * i, Y);
}
}
private void button2_Click(object sender, EventArgs e)
{
Console.WriteLine("click");
MessageBox.Show("click me");
}
}
}
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Mixi
{
public partial class FrmTest : Mixi.FrmBase
{
[DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
[Flags]
public enum MouseEventFlags
{
LEFTDOWN = 0x00000002,
LEFTUP = 0x00000004,
MIDDLEDOWN = 0x00000020,
MIDDLEUP = 0x00000040,
MOVE = 0x00000001,
ABSOLUTE = 0x00008000,
RIGHTDOWN = 0x00000008,
RIGHTUP = 0x00000010
}
public static void LeftClick(int x, int y)
{
Cursor.Position = new System.Drawing.Point(x, y);
mouse_event((int)(MouseEventFlags.LEFTDOWN), 0, 0, 0, 0);
mouse_event((int)(MouseEventFlags.LEFTUP), 0, 0, 0, 0);
}
public FrmTest()
{
try
{
InitializeComponent();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
//Call the imported function with the cursor's current position
int X = Cursor.Position.X + 100;
int Y = Cursor.Position.Y + 10;
LeftClick(X, Y);
}
private void FrmTest_Load(object sender, EventArgs e)
{
}
private void FrmTest_KeyPress(object sender, KeyPressEventArgs e)
{
int X = Cursor.Position.X ;
int Y = Cursor.Position.Y ;
for(int i =0;i<10;i++)
{
Console.WriteLine("click");
textBox1.Text += i.ToString() + ";";
LeftClick(X + 20 * i, Y);
}
}
private void button2_Click(object sender, EventArgs e)
{
Console.WriteLine("click");
MessageBox.Show("click me");
}
}
}