GetKeyNameText

Pages: 12
1
2
3
4
5
6
7
8
9
10
11
12
13
KBDLLHOOKSTRUCT cKey = *((KBDLLHOOKSTRUCT*)lParam);

TCHAR *lpszName = new TCHAR[256];

            DWORD dwMsg = 1;
            dwMsg += cKey.scanCode << 16;
            dwMsg += cKey.flags << 24;

            int i = GetKeyNameText(dwMsg , lpszName, 255);

            out << *lpszName << "\n";

            delete[] lpszName;


I'm getting an error, I really don't kow what to do with it.

I need some help
bluespeed30 wrote:
I'm getting an error, I really don't kow what to do with it.
Don't know what to do with that error? Here's a few options:
1. Read the error
2. Google the error
3. Copy and paste the exact error here and indicate which line in your code this error is relevant to.
It's true I didn't specified the error my bad sorry

It's not on a line it's a kind of general error the code compile evrythings run but i'm getting an error of type : buffer overrun so I,m realy confuse and I don't know what to do

I need some help
You need to copy and paste the exact error message. If it doesn't have a specific line that's fine.
Give me a second
A buffer overrun has occurred in Game.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.

STATUS_STACK_BUFFER_OVERRUN encountered
Game.exe has triggered a breakpoint.
The program '[9168] Game.exe' has exited with code -1073740791 (0xc0000409).
I don't think the error is occurring within the code you posted. Can you put debug print statements throughout your code to see exactly where it stops on the error?

Also,
out << *lpszName << "\n";
This only prints the first character, not the whole string.
How can i print the hole string if I manage to print the whole string I think I can get it working another way


Also, it's getting really laggy when I run it and the error pop

And I don,t get what you mean by debug print statement
I've got the error out I saw where I did my error but I'm still only getting the first letter of each word like for tab it prints T need some help
bluespeed30 wrote:
How can i print the hole string if I manage to print the whole string I think I can get it working another way
out << lpszName << std::endl;
Note the lack of the * above.
bluespeed30 wrote:
And I don,t get what you mean by debug print statement
Do you mean to tell me that you have no way of displaying a message in the console? No way at all?
Last edited on
For backspace I get : 006E3678
And for enter I get : 006E3668

These are adress I guess of the array
Last edited on
What is 'out'? A C++ stream will normally take a character array and display it as a string. Is 'out' in ANSI while TCHAR is in Unicode?
Since I'm using a winmain and not int main() I have no console so I've made a stream to a text file to print things while testing


ofstream out("test.txt", ios::out | ios::app);

Are you compiling in Unicode? Try using wofstream instead.
You can get the console too if you use AllocConsole().
Give me a minute I will try what you said
Thanks both of you the wofstream did the job thanks
By the way with the console I'm getting weird output like beforethe aaddress and not the letter like wofstream
Anyone ??
1. I didn't understand your question?
2. No need to bump like that, you can edit your posts, there is a Edit button on the bottom-right of a post
3. Uhm, no, April Fools' joke, no HL3.

Tried re-interpreting it...
Try wcout?
Last edited on
Pages: 12