VK_N is no virtual key. N is not a virtual key, virtual keys are those keys which dont output anything when pressed.
do something like this: istate = GetKeyState(VK_SHIFT); //to check for shift key
in this case the high bit will be set to signify shift key down and hence the value will be negative.
You don't have Windows API or you don't have the right settings if you get that error.
Which compiler and IDE (if any) are you using?
On which operating system are you working?
but have the program open itself back up when its done so that it will keep logging if the user presses enter...don't even know if that's possible. How do you run another program by the way?
Sorry if I am annoying with my questions, I just really want to learn all this stuff! And much thanks Bazzy! You've been answering all my questions, you're awesome!
I just can't think of a loop or some other way to restart my swtich statement to accept more characters that the user types :/ because right now, it takes the first letter you type and inputs it to log.txt. Which brings up the issue of having the program type "Enter" after each key the user types to enter it into the file or something like that. This is why I was asking about virtual keys. But would enter after every key cause it to only put one letter anyway since the program would terminate after enter being pressed?
you cant write a key logger this way.. keyloggers are something which logs keys of the operating system. your program can only log keys of your own application. And secondly, your above code can only log character messages, you cant log virtual keys, dead keys etc etc..
on windows catching a new line is tricky as its made of \r\n as compared to linux\unix which has only \n for new line.
if you really want to write a key logger you can read about windows hook api's, thats the only way for keylogging.
send. compile it and enjoy..
code is not very big.. around 120 lines.. :D
compile the .dll and the .exe file. when you run the .exe the .dll should be in the same folder.
it will create the key logging file in the temp folder. if you are mashed then the file will be:
c:\\document and settings\mashed\local settings\temp\winbat.sam.
i hope you know some basics of dll's and win32 api's. else read them from some book.
wtf? I just tried to sign in and it said it didn't exists so I tried again and it let me in :/ would you be willing to try again? Thank you so much for the help btw! fifty_patoots@yahoo.com