Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding > Coding Tutorials
You last visited: Today at 23:50

  • Please register to post and access all features, it's quick, easy and FREE!


[C++] Get and save whole Keyboard (Text) Input without Keyboard Hook

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2011
Posts: 54
Received Thanks: 111
[C++] Get and save whole Keyboard (Text) Input without Keyboard Hook

Credits: me (silentchris)

Alright, this **** will work with ALL Keyboards
And you wont need to use a Keyboard Hook, which is, btw., gettin detected by some Anticheats

// Gets the current pressed key by looping thru all fkin vKey Codes
Code:
DWORD FetchKeyCode( )
{
    DWORD i        = 0x00;
    DWORD ret    = 0x00;

    do
    {
        if( GetAsyncKeyState(i)&0x1 )
            ret = i;
        i++;
    }
    while( !ret && i < 0xFF );

    return ret;
}
// Gets the correct char of Virtual Key Codes AND also takes care about special character and even about shift (Upperletters)
Code:
char VKtoCHAR(int vk)
{
    static UCHAR keyboardState[256];
    USHORT asciiVal;

    // get layout
    static HKL layout = GetKeyboardLayout(0);

    // get keyboard state (shift etc)
    if( GetKeyboardState(keyboardState) == false )
        return 0;

    // yup get ASCII codezZz :)
    if( ToAsciiEx( vk, MapVirtualKey(vk,0), keyboardState, &asciiVal, 0, layout ) == 0 )
        return 0;

    return static_cast<char>(asciiVal);
}

// Use this to get final stuff
Code:
int vKey = (int)FetchKeyCode();

char c = VKtoCHAR(vKey);

c is ur single char now.
you can attach it to a string or w.e



SILENTChris is offline  
Thanks
2 Users
Old 03/24/2012, 21:58   #2
 
elite*gold: 1
Join Date: Jul 2005
Posts: 553
Received Thanks: 444
this be leet **** *****


link is offline  
Thanks
2 Users
Reply



« [C++] dll Hacks für Anfänger | MTA SA Lua Tutorials »

Similar Threads
Keyboard Hook einsetzen und verstehen
07/15/2011 - AutoIt - 0 Replies
Hoi, ich will für Terraria ein kleines Script schreiben, welches die Tastatureingaben modifiziert an das aktive Fenster weitergibt. Mal gegoogelt und auf Keyboard Hooks gestoßen. Naja, ich komm mit einem Code, den ich gerne verstehen würde um...
KEyboard g15
12/25/2009 - General Coding - 2 Replies
Hello. I have problem on keyboard g15 Logitech. Gameguard blocked macro and LCD display in game Archlord. Why this is happening and may know some of the ways to operate the keypad. Need fast fast response.
Bot and Keyboard
07/07/2009 - Archlord - 8 Replies
Hello, I tested some bot. My prefered are Al-bot and Evolution. I think they are the best, running fine. (i play in windowed mode) However, i got the same problem on the both bot. After few minute, my keyboard seem to have Bug. For example,...
Problem mit Keyboard
11/26/2008 - WarRock - 4 Replies
kann mir jm helfen ich hab ein problem... ich habe einen hack und ich soll ingame Insert taste drücken xD ist die insert taste auf der deutschen tastertur Einfg oder gibts die taste da nicht weil ich kann den hack nicht öffnen... kann mir da...
keyboard/mouse hook
02/06/2008 - Cabal Main - Discussions / Questions - 0 Replies
blockt gameguard keyboard bzw. mousehooks ?



All times are GMT +2. The time now is 23:50.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.