PDA

Click to See Complete Forum and Search --> : CapsLock


MidgetsBro
Jan 17th, 2001, 10:58 AM
How can I turn the capslock on in C++? I am just making a console program for my computer class, but the program I am making requires you to turn the capslock on for it to work. Thanks.

Vlatko
Jan 17th, 2001, 11:59 AM
BYTE bar[256];
GetKeyboardState(bar);
bar[VK_CAPITAL] = 1;
SetKeyboardState(bar);

MidgetsBro
Jan 17th, 2001, 02:29 PM
I tried that code, and I get 9 errors. How can I fix this?

Thanks again.

Vlatko
Jan 17th, 2001, 04:32 PM
The code works fine for me. Did you include windows.h

#include <windows.h>
....
BYTE bar[256];
GetKeyboardState(bar);
bar[VK_CAPITAL] = 1;
SetKeyboardState(bar);

MidgetsBro
Jan 17th, 2001, 05:11 PM
Thanks! I didn't know I had to include windows.h. I'm realitively new to C++ programming, so I don't know all the different headers that are needed. Thank you Vlatko.