need help with getkeystate

This is a discussion on need help with getkeystate within the C++ Programming forums, part of the General Programming Boards category; hi i need help, I have no idea what the problem is, what im trying to do is simply make ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    4

    need help with getkeystate

    hi i need help, I have no idea what the problem is, what im trying to do is simply make a console application that will capture any key I type. Problem is I want to make sure whether it's a capital key or no etc so first I check if the caps is on using if (GetKeyState(20)<0) and then i check if shift key is pressed with if (GetKeyState(VK_Shift)<0) (cuz if it is then it would make it a small letter) and then I try to save the key as a small letter obviously. I do it for all the possible combinations etc( so 4 in total), but it always turns out one of them doesn't work properly, either it doesnt capture any key from a to z or just outputs it as a capital letter when it should be the other way around and vice versa. And then if I try to fix that so just play around, like change either the < sign to >= etc or change the value from 0 to 1 or put ! infront of GeyKeyState I manage to fix that one but then some other comparison etc is not working correctly. I'm stuck on this for hours, so hope someone can help me on this thanks.

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    902
    You might have better luck catching keystrokes without a console.
    Either way, let's see some code, inputs, and the output.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    4
    never mind, i've managed to find a way to make it work but i had to spend a lot of time on it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GetKeyState equivalent function ...
    By twomers in forum C++ Programming
    Replies: 9
    Last Post: 02-24-2006, 02:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21