Skip to main content

AccessTr.neT


VS C# Mouse Click kodu?

jiloooo
jiloooo
3
6393

VS C# Mouse Click kodu?

#1
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
Cevapla
#2
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...
Cevapla
#3
[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
Son Düzenleme: 26/12/2013, 01:55, Düzenleyen: jiloooo.
Cevapla
#4
Çok zor ve karmaşık bir konu bende denedim ama beceremedim Img-grin
Bir mum, diğer mumu tutuşturmakla ışığından bir şey kaybetmez.(Mevlana)
Herkesin yardımlaştığı yerde işler yarım kalmaz...
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da
Task