beyler amacım c# form üzerinde olan butona tıklangından mouse un 10 kere ard arda click yapmasını saglamak. kodu bulamadım bitürlü yardımlarınızı bekliyorum
kodu aradım taradım buldum belki işinize yarar paylaşıyorum burdan using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices;
namespace WindowsFormsApplication2 { public partial class Form1 : Form
{ [DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02; private const int MOUSEEVENTF_LEFTUP = 0x04;
public Form1() { DoMouseClick(); } public void DoMouseClick() { for (int i = 0; i < 200; i++) { System.Threading.Thread.Sleep(100); //Call the imported function with the cursor's current position int X = Cursor.Position.X; int Y = Cursor.Position.Y; mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0); }
} } }
quote:
Orijinalden alıntı: g.bale
kodu aradım taradım buldum belki işinize yarar paylaşıyorum burdan using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices;
namespace WindowsFormsApplication2 { public partial class Form1 : Form
{ [DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02; private const int MOUSEEVENTF_LEFTUP = 0x04;
public Form1() { DoMouseClick(); } public void DoMouseClick() { for (int i = 0; i < 200; i++) { System.Threading.Thread.Sleep(100); //Call the imported function with the cursor's current position int X = Cursor.Position.X; int Y = Cursor.Position.Y; mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0); }