добрый день - Форум Cheat-Master.ru
  • Страница 1 из 1
  • 1
Модератор форума: Sanoxxx, Alowir  
добрый день
esen3ik Дата: Среда, 16.02.2022, 13:47 | Сообщение # 1
Новичок
Сообщений: 1
Статус: Offline
тут искал и столкнулся с горячими клавишами GlobalKeyBoardHook.cs
как все гроки знают у warcraft 3 есть хоткей именно через numpad 1 до Numpad 8
как можно через GlobalKeyBoardHook.cs передать варрафту??
тут форма
Код
gHook = new GlobalKeyboardHook();
            gHook.KeyDown += new KeyEventHandler(MyKeyDown);
            foreach (Keys key in Enum.GetValues(typeof(Keys)))
                gHook.HookedKeys.Add(key);

вот сам класс
Код
#region License_Do_Not_Remove
/*
*  Made by TheDarkJoker94.
*  Check http://thedarkjoker94.cer33.com/ for more C# Tutorials
*  and also SUBSCRIBE to my Youtube Channel http://www.youtube.com/user/TheDarkJoker094  
*  GlobalKeyboardHook is licensed under a Creative Commons Attribution 3.0 Unported License.(http://creativecommons.org/licenses/by/3.0/)
*  This means you can use this Code for whatever you want as long as you credit me! That means...
*  DO NOT REMOVE THE LINES ABOVE !!!
*/
#endregion
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;

public class GlobalKeyboardHook
{
    [DllImport("user32.dll")]
    static extern int CallNextHookEx(IntPtr hhk, int code, int wParam, ref keyBoardHookStruct lParam);
    [DllImport("user32.dll")]
    static extern IntPtr SetWindowsHookEx(int idHook, LLKeyboardHook callback, IntPtr hInstance, uint theardID);
    [DllImport("user32.dll")]
    static extern bool UnhookWindowsHookEx(IntPtr hInstance);
    [DllImport("kernel32.dll")]
    static extern IntPtr LoadLibrary(string lpFileName);

    public delegate int LLKeyboardHook(int Code, int wParam, ref keyBoardHookStruct lParam);

    public struct keyBoardHookStruct
    {
        public int vkCode;
        public int scanCode;
        public int flags;
        public int time;
        public int dwExtraInfo;
    }

    const int WH_KEYBOARD_LL = 13;
    const int WM_KEYDOWN = 0x0100;
    const int WM_KEYUP = 0x0101;
    const int WM_SYSKEYDOWN = 0x0104;
    const int WM_SYSKEYUP = 0x0105;

    LLKeyboardHook llkh;
    public List<Keys> HookedKeys = new List<Keys>();

    IntPtr Hook = IntPtr.Zero;

    public event KeyEventHandler KeyDown;
    public event KeyEventHandler KeyUp;

    public GlobalKeyboardHook()
    {
        llkh = new LLKeyboardHook(HookProc);

    }
    ~GlobalKeyboardHook()
    { unhook(); }

    public void hook()
    {
        IntPtr hInstance = LoadLibrary("User32");
        Hook = SetWindowsHookEx(WH_KEYBOARD_LL, llkh, hInstance, 0);
    }

    public void unhook()
    {
        UnhookWindowsHookEx(Hook);
    }

    public int HookProc(int Code, int wParam, ref keyBoardHookStruct lParam)
    {
        if (Code >= 0)
        {
            Keys key = (Keys)lParam.vkCode;
            if (HookedKeys.Contains(key))
            {
                KeyEventArgs kArg = new KeyEventArgs(key);
                if ((wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) && (KeyDown != null))
                    KeyDown(this, kArg);
                 if ((wParam == WM_KEYUP || wParam == WM_SYSKEYUP) && (KeyUp != null))
                    KeyUp(this, kArg);
                if (kArg.Handled)
                    return 1;
            }
        }
        return CallNextHookEx(Hook, Code, wParam, ref lParam);
    }

}



esen3ik
ProFIX_VladY Дата: Среда, 01.06.2022, 23:31 | Сообщение # 2
Новичок
Сообщений: 3
Статус: Offline
Если про плюсы тогда GetAsyncKeyState в помощь

https://cheat-master.ru/index/8-142477 - Мой бывший аккаунт ☹
  • Страница 1 из 1
  • 1
Поиск:
Статистика Форума
Лучшие пользователи
Admin [39113]

GеNius [7210]

[CM]Russel [5557]

kenlo763 [4952]

[CM]AGRESSOR [4639]

Snake_Firm [4452]

Сэс [4416]

Artem_Buero [4223]

[CM]Durman [3204]

[CM]Рафаэль [3080]

iMaddy [2855]

sky_Woker [2854]

getrekt [2745]

Новые пользователи
balbesbizad [12:02]

cpark [11:40]

Mario_Imperator [11:33]

leonovichstas97 [22:40]

ubeyefudu [18:53]

zheniakuzma [17:47]

Moonberg [16:04]

tamararl6 [15:04]

consuelobm3 [08:03]

cerbiuo [04:52]

Babad [03:11]

лесопилка [02:42]

Mahsut584 [01:25]