AccessTr.neT
VS C# Mouse Click kodu? - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: AccessTr.neT Genel (https://accesstr.net/forum-accesstr-net-genel.html)
+--- Forum: Serbest Bölge (https://accesstr.net/forum-serbest-bolge.html)
+--- Konu Başlığı: VS C# Mouse Click kodu? (/konu-vs-c-mouse-click-kodu.html)



VS C# Mouse Click kodu? - jiloooo - 26/12/2013

forumda 2 buton olacak
buton1_click olayına mouse sol tuş belli saniye aralıklarla tık tık basmasını
buton2_click olayına ise tıklama olayını bitirmesini istiyorum

0.5 saniye aralıklarla sonsuz döngüde sol tık yapan kodları nasıl oluşturabilirim?

teşekkürler


Cvp: VS C# Mouse Click kodu? - mahmut18 - 26/12/2013

Hiç süre bazında click olayını denememiştim cevap gelirse öğrenmiş olacağız ama bir yerden edindiğim bir bilgi var umarım azda olsa yardımcı olur,

Mousenin 10 kere ard arda click olayı ;

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);
}

}
}
}

Siz arayın yaparsanız ve kodları paylaşırsanız çok iyi olur en azından diğer arkadaşlar ve bende bilgilenmiş oluruz iyi geceler...


Cvp: VS C# Mouse Click kodu? - jiloooo - 26/12/2013

[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;
private void Form1_Load(object sender, EventArgs e)
{

}
public static void MouseLeftClick(Point pos)
{
System.Windows.Forms.Cursor.Position = pos;
mouse_event(MOUSEEVENTF_LEFTDOWN, pos.X, pos.Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, pos.X, pos.Y, 0, 0);
}
private void timer1_Tick(object sender, EventArgs e)
{
MouseLeftClick(MousePosition);
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}


ne hata veriyor ne de çalışıyor Img-grin


Cvp: VS C# Mouse Click kodu? - mahmut18 - 26/12/2013

Çok zor ve karmaşık bir konu bende denedim ama beceremedim Img-grin