#include <iostream>
#include <windows.h>
usingnamespace std;
int main()
{
char i;
bool caps = false;
while(true){
for(int i = 8; i < 255; i++){
// program tests to see if the a key is pressed also checks to see if it is a capital or lower case pressed
// if((GetKeyState(VK_CAPITAL) & 0x0001)!=0 if not = 0 that means caps is on and if 0 means it is off
if(GetAsyncKeyState(i) == -32767){
if((GetKeyState(VK_CAPITAL) & 0x0001)!=0){
caps = true;
}
if((GetKeyState(VK_CAPITAL) & 0x0001)==0){
caps = false;
}
if(i == 65 && !caps){
char c = (char) i;
c = c + 32;
cout << c << endl;
}
if(i == 65 && caps){
char c = (char) i;
cout << c << endl;
}
}
}
}
}
GetKeyState(VK_CAPITAL) & 0x0001)==0
I'm wondering why we use a bitwise & rather than a logical & if I was to take an educated guess I would we are checking to see if VK_CAPITAL's last bit is set to 0 then caps lock is off?