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.
Printable View
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.
Code:BYTE bar[256];
GetKeyboardState(bar);
bar[VK_CAPITAL] = 1;
SetKeyboardState(bar);
I tried that code, and I get 9 errors. How can I fix this?
Thanks again.
The code works fine for me. Did you include windows.h
Code:#include <windows.h>
....
BYTE bar[256];
GetKeyboardState(bar);
bar[VK_CAPITAL] = 1;
SetKeyboardState(bar);
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.