⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsmouserecord.cs

📁 原创: 外挂网站刷IP程序的源码 自动ADSL拨号刷新IP,可录制鼠标模拟点击自动点击操作,统计点击数,自动清除COOKIES记录
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using qdog.Mouse;
using System.Diagnostics;
using System.Windows.Forms;
using qdog;

namespace DialUp
{
    class MousePos
    {
        public int X=0;
        public int Y=0;
    }

    class clsMouseRecord : qdog.Mouse.UserActivityHook
    {
        //UserActivityHook m_usrHook;
        Boolean m_bIsRecord = false;
        Boolean m_bDebug = false;
        qdog.XmlConfig m_xmlConfig;
        const string XML_FILENAME = "Record.xml";

        string m_strSession = "";
        int m_nPos = 0;

        public clsMouseRecord()
        {
            OpenXmlFile();
        }

        ~clsMouseRecord()
        {
            m_xmlConfig.Dispose();
        }

        private void OpenXmlFile()
        {
            string strXmlFile = clsCommon.RunPath();
            strXmlFile = System.IO.Path.Combine(strXmlFile, XML_FILENAME);
            m_xmlConfig = qdog.XmlConfig.Instance(strXmlFile);

        }

        public MousePos[] GetAllRecord(string strName)
        {
            OpenXmlFile();
            string[] strKeys = m_xmlConfig.Keys(strName);
            MousePos[] mpValue =new MousePos[strKeys.Length/2];
            int i = 0;
            string strLastKey = "~";
            foreach (string strKey in strKeys)
            {
                int nPos = strKey.IndexOf("_");
                string strTmp = strKey.Substring(0, nPos);
                if (strKey.Contains(strLastKey) == false)
                {
                    strLastKey = strTmp;
                    mpValue[i] = new MousePos();
                    mpValue[i].X = int.Parse(m_xmlConfig.Read(strName, strTmp + "_x").ToString());
                    mpValue[i].Y = int.Parse(m_xmlConfig.Read(strName, strTmp + "_y").ToString());
                    i++;
                }
            }
            return mpValue;
        }

        public Boolean StartRecord(string strName, bool bDebug)
        {
            m_bDebug = bDebug;

            string strNewName="";
            if (strName == "")
                strNewName = Microsoft.VisualBasic.Interaction.InputBox("请输入新的录制名称", "", "新名称", -1, -1);
            else
                strNewName = strName;

            if (strNewName != "")
            {
                m_xmlConfig.DeleteSection(strNewName);
                m_strSession = strNewName;
            }


            //if (m_usrHook==null)
            //    m_usrHook = new UserActivityHook();

            this.OnMouseActivity += new MouseEventHandler(MouseMoved);
            this.KeyDown += new KeyEventHandler(MyKeyDown);
            this.KeyPress += new KeyPressEventHandler(MyKeyPress);
            this.KeyUp += new KeyEventHandler(MyKeyUp);
            //UserActivityHook.SetCursorPos(1, 1);

            m_bIsRecord = true;
            Debug.Print("start record.");
            this.Start();
            return true;
        }

        public Boolean StartRecord()
        {
            return StartRecord("",false);
        }

        public Boolean StartRecord(string strName)
        {
            return StartRecord(strName, false);
        }

        public void StopRecord()
        {

            m_bIsRecord = false;
            Debug.Print("start record.");
            this.Stop();
            m_xmlConfig.Dispose();
            Debug.Print("stop record.");
        }

        public void MouseMoved(object sender, MouseEventArgs e)
        {
            //Debug.Print(String.Format("x={0}  y={1} wheel={2}", e.X, e.Y, e.Delta));
            if (m_bDebug && e.Clicks > 0)
            {
                Debug.Print("MouseButton 	- " + e.Button.ToString());
                Debug.Print(String.Format("x={0}  y={1} wheel={2}", e.X, e.Y, e.Delta));
            }

            if (e.Clicks > 0 && m_bIsRecord)
            {
                m_nPos++;
                m_xmlConfig.Write(m_strSession, "step" + m_nPos + "_x", e.X);
                m_xmlConfig.Write(m_strSession, "step" + m_nPos + "_y", e.Y);
            }
        }

        public void MyKeyDown(object sender, KeyEventArgs e)
        {
            if (m_bDebug)
            {
                Debug.Print("KeyDown 	- " + e.KeyData.ToString() + "(" + e.KeyCode.ToString() + ")");
            }
        }

        public void MyKeyPress(object sender, KeyPressEventArgs e)
        {
            if (m_bDebug)
            {
                Debug.Print("KeyPress 	- " + e.KeyChar + "(" + (int)e.KeyChar + ")");
            }
        }

        public void MyKeyUp(object sender, KeyEventArgs e)
        {
            if (m_bDebug)
            {
                Debug.Print("KeyUp 		- " + e.KeyData.ToString() + "(" + e.KeyCode.ToString() + ")");
            }
        }

    }

    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -