Results 1 to 4 of 4
  1. #1
    rawr im a tiger's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    On the edge of Sanity
    Posts
    238
    Reputation
    40
    Thanks
    1,017
    My Mood
    Angelic

    My keyboard hooks are fail

    Code:
    #include "stdafx.h"
    
    void Hax(int id);
    void Hook();
    
    HHOOK keybdhook;
    LRESULT CALLBACK KeyboardHook(int nCode,WPARAM wParam,LPARAM lParam);
    
    DWORD WINAPI CreateHooks( LPVOID lpParam )
    {
    	Hook();
    	return 0;
    }
    
    void Hook()
    {
    	keybdhook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHook, GetModuleHandle(0), 0);
    }
    
    LRESULT CALLBACK KeyboardHook(int nCode,WPARAM wParam,LPARAM lParam)
    {
    	KBDLLHOOKSTRUCT* key;
    	if(wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN)
    	{
    		key = (KBDLLHOOKSTRUCT*)lParam;
    
    		// advantages
    		if(key->vkCode == VK_F8)
    		{
    			Hax(2);
    			Hax(3);
    		}
    
    		// esp
    		if(key->vkCode == VK_F9)
    		{
    			Hax(4);
    			Hax(5);
    			Hax(7);
    		}
    
    		// thermal + laser
    		if(key->vkCode == VK_F7)
    		{
    			Hax(1);
    			Hax(6);
    		}
    	}
    	return CallNextHookEx(keybdhook,nCode,wParam,lParam);
    }
    Nothing happens when I press f7, f8 or f9. The CreateHooks() function is being called, I know that for sure, the error is in this code.

    Thanks in advance.

    EDIT: Oh, and the Hax function does work too

  2. #2
    Eidolon's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Vanished
    Posts
    822
    Reputation
    54
    Thanks
    4,034
    My Mood
    Angelic
    You had to do something like if((VK_X)&1)




    Yet, you are a pathetic human.

    Contributor since: 7.26.2012 - ended
    Donator since: 7.14.2012


  3. #3
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,940
    Reputation
    574
    Thanks
    5,005
    My Mood
    Twisted
    You had troubles with Hotkeys before ? I had them yesterday, just searched a bit on the coding forums of MPGH till i found a solution But that was VB, i dont know a thing about C++
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  4. #4
    Eidolon's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Vanished
    Posts
    822
    Reputation
    54
    Thanks
    4,034
    My Mood
    Angelic
    Code:
    if(GetAsyncKeyState(VK_XXXXXXX)&1)
    This is how to do it




    Yet, you are a pathetic human.

    Contributor since: 7.26.2012 - ended
    Donator since: 7.14.2012


  5. The Following User Says Thank You to Eidolon For This Useful Post:

    rawr im a tiger (07-29-2012)

Similar Threads

  1. [Source Code] Basic Keyboard Hooks
    By Kantanomo in forum C# Programming
    Replies: 0
    Last Post: 05-25-2011, 06:20 PM
  2. Hacks are failing
    By kapethan in forum Combat Arms Help
    Replies: 2
    Last Post: 07-31-2010, 12:16 AM
  3. [Vb.net] Keyboard Hook?
    By ppl2pass in forum Visual Basic Programming
    Replies: 2
    Last Post: 07-11-2010, 06:19 PM
  4. Keyboard hook in C++
    By B1ackAnge1 in forum C++/C Programming
    Replies: 15
    Last Post: 11-24-2009, 03:20 AM
  5. D3D Hook Hacks are laggy now?
    By yingrox in forum Combat Arms Help
    Replies: 0
    Last Post: 11-21-2009, 02:23 PM