-
大小: 28KB文件類(lèi)型: .7z金幣: 1下載: 0 次發(fā)布日期: 2021-06-02
- 語(yǔ)言: 其他
- 標(biāo)簽:
資源簡(jiǎn)介
可設(shè)置毫秒,可用于網(wǎng)絡(luò)游戲隨機(jī)強(qiáng)化裝備等
代碼片段和文件信息
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;???????//鍵盤(pán)是否按下的標(biāo)志
????????????public?int?time;
????????????public?int?dwExtraInfo;
????????}
????????private?const?int?WH_KEYBOARD_LL?=?13;??????//鉤子類(lèi)型?全局鉤子
????????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?=?“[已啟動(dòng)]“;
????????????????????????}
????????????????}
????????????????if?(bStopMsg)?return?1;
????????????}
????????????return?CallNextHookEx(hHook?nCode?wParam?lParam);//繼續(xù)傳遞消息
????????}
????????public?Form1()
????????{
????????????InitializeComponent();
????????????this.comboBox1.SelectedIndex?=?0;//默認(rèn)索引值
????????????this.comboBox1.DropDownstyle?=?ComboBoxstyle.DropDownList;//僅在列表中選擇
????????????th
評(píng)論
共有 條評(píng)論