C# ile v tuşuna basınca 3 kez sağ tıklayıp sonra 1 butonuna tıklatma

Öyle bir şey ki yaparken sağımı solumu karıştırdım :D

C#:
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        public static extern void mouse_event(int dwFlags, int dX, int dY, int cButtons, int dwExtraInfo);

        public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
        public const int MOUSEEVENTF_RIGHTUP = 0x10;

        public static void rightClick()
        {
            int xPos = Cursor.Position.X;
            int yPos = Cursor.Position.Y;

            mouse_event(MOUSEEVENTF_RIGHTDOWN, xPos, yPos, 0, 0);
            mouse_event(MOUSEEVENTF_RIGHTUP, xPos, yPos, 0, 0);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SendKeys.Send("(3)");

            rightClick();

            SendKeys.Send("(1)");
        }
    }
 
Son düzenleme:
Öyle bir şey ki yaparken sağımı solumu karıştırdım :D

C#:
public partial class Form1 : Form.
 {
 public Form1()
 {
 InitializeComponent();
 }

 [System.Runtime.InteropServices.DllImport("user32.dll")]
 public static extern void mouse_event(int dwFlags, int dX, int dY, int cButtons, int dwExtraInfo);

 public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
 public const int MOUSEEVENTF_RIGHTUP = 0x10;

 public static void rightClick()
 {
 int xPos = Cursor.Position.X;
 int yPos = Cursor.Position.Y;

 mouse_event(MOUSEEVENTF_RIGHTDOWN, xPos, yPos, 0, 0);
 mouse_event(MOUSEEVENTF_RIGHTUP, xPos, yPos, 0, 0);
 }

 private void button1_Click(object sender, EventArgs e)
 {
 SendKeys.Send("(3)");

 rightClick();

 SendKeys.Send("(1)");
 }
 }

Deniyorum şimdi.
 
Ooh Minecraft olta, pot makrosu yapmaca.🤣

Evet :D
Öyle bir şey ki yaparken sağımı solumu karıştırdım :D

C#:
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        public static extern void mouse_event(int dwFlags, int dX, int dY, int cButtons, int dwExtraInfo);

        public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
        public const int MOUSEEVENTF_RIGHTUP = 0x10;

        public static void rightClick()
        {
            int xPos = Cursor.Position.X;
            int yPos = Cursor.Position.Y;

            mouse_event(MOUSEEVENTF_RIGHTDOWN, xPos, yPos, 0, 0);
            mouse_event(MOUSEEVENTF_RIGHTUP, xPos, yPos, 0, 0);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SendKeys.Send("(3)");

            rightClick();

            SendKeys.Send("(1)");
        }
    }
Önem Derecesi Kod Açıklama Proje Dosya Çizgi Gizleme Durumu
Hata CS0542 'Form1': üye adları kapanış türleri ile aynı olama OltaMakrosu C:\Users\****\source\repos\OltaMakrosu\OltaMakrosu\Form1.cs 9 Etkin

diye bir hata alıyorum çözümünnedir?
 

Yeni konular

Geri
Yukarı