Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding > Coding Tutorials
You last visited: Today at 21:46

  • 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   #2
 
elite*gold: 1
Join Date: Jul 2005
Posts: 553
Received Thanks: 443
this be leet **** *****


link is offline  
Thanks
2 Users
Reply



« Previous Thread | Next Thread »

Similar Threads
Keyboard Hook einsetzen und verstehen
Hoi, ich will für Terraria ein kleines Script schreiben, welches die Tastatureingaben modifiziert an das aktive Fenster weitergibt. Mal gegoogelt...
0 Replies - AutoIt
KEyboard g15
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...
2 Replies - General Coding
Bot and Keyboard
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...
8 Replies - Archlord
Problem mit Keyboard
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...
4 Replies - WarRock
keyboard/mouse hook
blockt gameguard keyboard bzw. mousehooks ?
0 Replies - Cabal Main - Discussions / Questions



All times are GMT +2. The time now is 21:46.


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.