Results 1 to 1 of 1
  1. #1
    Wget
    Wget is offline
    Guest
    Join Date
    2013 Sep
    Posts
    1
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    Gravar e reproduzir movimento do moues

    O Código a seguir é bem simples ele grava as posições do mouse e depois o reproduz.
    Sabendo utiliza-lo e alopta-lo, as possibilidades são muitas.

    PHP Code:
    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 Xint Y);

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

            private 
    void SimulaTimer_Tick(object senderEventArgs 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 senderEventArgs 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 senderEventArgs 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 senderEventArgs e)
            {
                
    this.Maxim****ox false;
            }
        }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •