• 大小: 28KB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2021-06-02
  • 语言: 其他
  • 标签:

资源简介

可设置毫秒,可用于网络游戏随机强化装备等

资源截图

代码片段和文件信息

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;
using System.Diagnostics;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        [System.Runtime.InteropServices.DllImport(“user32“)]
        private static extern int mouse_event(int dwFlags int dx int dy int cButtons int dwExtraInfo);
        const int MOUSEEVENTF_LEFTDOWN = 0x0002;
        const int MOUSEEVENTF_LEFTUP = 0x0004;
        [DllImport(“user32.dll“)]
        public static extern int SetWindowsHookEx(int idHook HookProc hProc IntPtr hMod int dwThreadId);
        [DllImport(“user32.dll“)]
        public static extern int CallNextHookEx(int hHook int nCode IntPtr wParam IntPtr lParam);
        [DllImport(“user32.dll“)]
        public static extern bool UnhookWindowsHookEx(int hHook);
        [DllImport(“kernel32.dll“)]//获取模块句柄  
        public static extern IntPtr GetModuleHandle(string lpModuleName);
        public struct KeyInfoStruct
        {
            public int vkCode;        //按键键码
            public int scanCode;
            public int flags;       //键盘是否按下的标志
            public int time;
            public int dwExtraInfo;
        }
        private const int WH_KEYBOARD_LL = 13;      //钩子类型 全局钩子
        private const int WM_KEYUP = 0x101;     //按键抬起
        private const int WM_KEYDOWN = 0x100;       //按键按下

        public delegate int HookProc(int nCode IntPtr wParam IntPtr lParam);
        bool bStopMsg = false;
        int hHook = 0;
        GCHandle gc;
        string b = “F1“;
        public int MethodHookProc(int nCode IntPtr wParam IntPtr lParam)
        {
            if (nCode >= 0)
            {
                KeyInfoStruct inputInfo = (KeyInfoStruct)Marshal.PtrToStructure(lParam typeof(KeyInfoStruct));
                if (wParam == (IntPtr)WM_KEYDOWN)
                {//如果按键按下
                    //  MessageBox.Show(((Keys)inputInfo.vkCode).ToString());
                    if (((Keys)inputInfo.vkCode).ToString() == b)
                        if (timer1.Enabled == true)
                        {
                            timer1.Enabled = false;
                            this.label3.Text = “[已停止]“;
                        }
                        else
                        {
                            timer1.Enabled = true;
                            this.label3.Text = “[已启动]“;
                        }
                }
                if (bStopMsg) return 1;
            }
            return CallNextHookEx(hHook nCode wParam lParam);//继续传递消息
        }

        public Form1()
        {
            InitializeComponent();
            this.comboBox1.SelectedIndex = 0;//默认索引值
            this.comboBox1.DropDownstyle = ComboBoxstyle.DropDownList;//仅在列表中选择
            th

评论

共有 条评论

相关资源