UnrealSkill-VIP
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

[Source] Record and Play Mouse Moviment C#

Ir para baixo

[Source] Record and Play Mouse Moviment C# Empty [Source] Record and Play Mouse Moviment C#

Mensagem por uNreal 11/7/2020, 18:38

Código:
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 SimularMouse_Wget_
{
    public partial class FrmPrincipal : Form
    {
        public FrmPrincipal()
        {
            InitializeComponent();
        }

        [DllImport("user32.dll")]
        static extern bool SetCursorPos(int X, int Y);

        public bool grav = false;
        public bool rep = false;
        public int Index;
        public int Findindex;
        public int[] x = new int[10000000];
        public int[] y = new int[10000000];

        private void SimulaTimer_Tick(object sender, EventArgs e)
        {
            lb_MouseX.Text = "Mouse X: " + Convert.ToString(Cursor.Position.X);
            lb_MouseY.Text = "Mouse Y: " + Convert.ToString(Cursor.Position.Y);

            if (grav == true)
            {
                Index = Index + 1;

                x[Index] = Cursor.Position.X;
                y[Index] = Cursor.Position.Y;

                lb_Movimentos.Text = "Movimentos: " + Index;

                if (Index == 10000000)
                {
                    grav = false;
                    btn_Grav.Text = "Gravar";
                }
            }

            if (rep == true)
            {
                Index = Index + 1;

                SetCursorPos(x[Index], y[Index]);

                lb_Movimentos.Text = "Movimentos: " + Index + " / " + Findindex;

                if (Index == Findindex)
                {
                    rep = false;
                    btn_Rep.Text = "Reproduzir";
                }
            }
        }

        private void btn_Grav_Click(object sender, EventArgs e)
        {
            if (grav == true)
            {
                Findindex = Index;

                Index = Findindex;

                grav = false;

                lb_Movimentos.Text = "Movimentos: " + Index + " / " + Findindex;

                btn_Grav.Text = "Gravar";
            }
            else
            {
                Index = 1;

                lb_Movimentos.Text = "Movimentos: " + Index + " / " + Findindex;

                grav = true;

                btn_Grav.Text = "Parar";
            }
        }

        private void btn_Rep_Click(object sender, EventArgs e)
        {
            if (rep == true)
            {
                rep = false;

                btn_Rep.Text = "Reproduzir";
            }
            else
            {
                Findindex = Index;

                Index = 1;

                rep = true;

                btn_Rep.Text = "Parar";
            }
        }

        private void FrmPrincipal_Load(object sender, EventArgs e)
        {
            this.Maxim****ox = false;
        }
    }

Crédit: Wget
uNreal
uNreal
ADM
ADM


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos