1

I'm barely on the verge of being considered knowledgable in anything I'm doing right now, so I appreciate the help...

I'm currently working on a C# Steam game trainer right now, and what I'd like to be able to do here is replace the current hotkey setup with one that will allow the user to press a combo of multiple buttons for the hotkey to activate, instead of being just limited to a single key for activation.

I have an issue when I go to enter a number in the drop down box in my trainer, but the number key won't input when I press it, due to this hotkey setup restricting it only to specific function of something else in the trainer. I think it maybe to do with the way the current hotkey code doesn't allow any button assigned to work on anything else other than the process specified in the trainer(?)

If it's possible, how would I go about implementing an alternative hotkey system that doesn't limit the use of the buttons assigned to only the process, (by that, I mean you can't press 1 or 2 in anything else other than the trainer when it's on), and how would I go about making it a multipler that works by pressing a combination of 2 keys instead of 1, like CTRL+F1, ALT+1, SHIFT+F1? Here is the code for the trainer I'm working on:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
using Memory;

namespace DBXVTrainerProject
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    [DllImport("user32.dll")]
    public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);

    public Mem MemLib = new Mem();

    public bool loaded;

    public object AllEn99_Checked { get; private set; }

    private void openGame()
    {
        if (loaded)
            return;

        //new memory.dll 1.0.2 function
        int gameProcId = MemLib.getProcIDFromName("DBXV");

        if (gameProcId != 0)
        {
            loaded = true;
            ProcessID.Text = ("Found!");
            MemLib.OpenGameProcess(gameProcId);

            int Badge = MemLib.readInt("base+0x01F43372,4ef5");

            if (Badge == 1)
                Badge_checkbox.Checked = true;
            else
                Badge_checkbox.Checked = false;
        }
    }

    protected override void WndProc(ref Message m) //hotbuttons
    {
        if (m.Msg == 0x0312)
        {
            int id = m.WParam.ToInt32();
            if (id == 1)
            {
                MemLib.writeMemory("base+01A47e4,2c,44,e,4c,c3", "int", "17");
            }
            { 
                if (id == 2)
                    MemLib.writeMemory("base+01A47e4,2c,44,e,4c,c3", "int", "22");
            }

        }
        base.WndProc(ref m);
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        RegisterHotKey(this.Handle, 1, 0, (int)Keys.D1);
        RegisterHotKey(this.Handle, 2, 0, (int)Keys.D2);


        if (backgroundWorker1.IsBusy == false)
            backgroundWorker1.RunWorkerAsync();
    }

    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
        while (true) //infinite loop
        {
            openGame();

Thanks!

Cpt.Noob
  • 11
  • 1

0 Answers0