Results 1 to 11 of 11
  1. #1
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely

    [Help]SetWindowHookEx

    im trying to make a trainer and use keyboard(numpads) to activate the HAX now i need a example of setwindowhookex. ive already looked up in google and msdn and couldnt find anything.
    GetAsyncKeyState is useless in this situation.
    Last edited by Matrix_NEO006; 02-01-2010 at 05:58 PM.

  2. #2
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Sorry for the late reply, I saw this earlier but I was busy.

    Anyways, here's a little example.

    [php]#include <windows.h>
    #include <iostream>

    using namespace std;


    LRESULT CALLBACK KeyboardHook(int Code,WPARAM wParam, LPARAM lParam)
    {
    PKBDLLHOOKSTRUCT Hook = (PKBDLLHOOKSTRUCT)lParam;
    if(wParam == WM_KEYDOWN)
    {
    if(Hook->vkCode == 'A')
    {
    cout<< "You pressed A";
    }
    }
    return CallNextHookEx(0,Code,wParam,lParam);
    }

    int main()
    {
    MSG msg;
    HINSTANCE hInstance = GetModuleHandle(NULL);
    SetWindowsHookEx(WH_KEYBOARD_LL,KeyboardHook,hInst ance,0);
    GetMessage(&msg,0,0,0);
    }
    [/php]

    I'm pretty sure you know what to do from here.

    I won't take any credit for this, B1ackAnge1 posted something on this a while ago.

  3. The Following 2 Users Say Thank You to Void For This Useful Post:

    Matrix_NEO006 (02-01-2010),why06 (02-01-2010)

  4. #3
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    yes i know the rest and also ive seen this before but i just couldnt find it.thx man.one more thing what if i want to press numpads.
    Last edited by Matrix_NEO006; 02-01-2010 at 08:26 PM.

  5. #4
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    I'm not too sure but I think it's something like...

    [php]
    if(Hook->vkCode == VK_NUMPAD0)
    {
    //Do stuff
    }
    [/php]

  6. #5
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    let me try.ya it works good thx. i did 'VK_NUMPAD1' before asking and it didnt work so ya this way works.
    Last edited by Matrix_NEO006; 02-01-2010 at 08:39 PM.

  7. #6
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted
    Actually getasync works. I can't paste the code Noe because I'm on my I pod. But it works. Just make it a function and inside call getasync for a key and the do somthing like return 1 or return 2 if it is off. and go from there

  8. #7
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by |-|3|_][({}PT3R12 View Post
    Actually getasync works. I can't paste the code Noe because I'm on my I pod. But it works. Just make it a function and inside call getasync for a key and the do somthing like return 1 or return 2 if it is off. and go from there
    I think he means it doesn't work because the method is patched or detected. Not that the function itself doesn't work.

  9. #8
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    i think he means if you use getasynckeystate always return 1 or 0; at the end .but your code works in Console only i need it for MFC.
    Last edited by Matrix_NEO006; 02-01-2010 at 11:54 PM.

  10. #9
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    GetAsyncKeyState should work outside consoles too, I've used it in DLL's etc ;S
    Ah we-a blaze the fyah, make it bun dem!

  11. #10
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted
    Yeh mine using it

    Snippet:
    Code:
    bool getkey()
    {
    	if(GetAsyncKeyState(VK_F10)&0x8000){
            return true;
        }
        return false;
    }

  12. #11
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    the problem is that it should work but MFC just compiles it and done i cant use while statement to keep checking for a key pressed.
    i think for MFC i have to use these.
    https://msdn.microsof*****m/en-us/libr...78(VS.85).aspx
    https://msdn.microsof*****m/en-us/libr...84(VS.85).aspx
    Last edited by Matrix_NEO006; 02-02-2010 at 07:02 PM.

Similar Threads

  1. [Help Request] Combat arms Vid help
    By djw111 in forum Combat Arms Help
    Replies: 4
    Last Post: 12-24-2011, 05:06 PM
  2. [Help Request] AFK Bot [help]
    By fet in forum Combat Arms Help
    Replies: 7
    Last Post: 04-28-2011, 03:17 AM
  3. [Help Request] Injector Admin help
    By asdfgas in forum Combat Arms Help
    Replies: 4
    Last Post: 04-27-2011, 06:12 PM
  4. [Help Request] Ajuda / Help
    By - Battery' in forum Combat Arms BR Coding Help
    Replies: 3
    Last Post: 04-22-2011, 07:15 PM
  5. [Help Request] Help my!
    By Windowns7 in forum Combat Arms BR Coding Help
    Replies: 2
    Last Post: 04-18-2011, 01:41 PM