The Program will generate a warning that Caps Lock is ON before entering the Password. GetkeyState function which is part of Windows API is used to detect the state of Caps Lock key. GetkeyState function retrieves the state of different keys.
Source Code
#include<iostream> #include<windows.h> using namespace std; int main () { string name; string password; cout<<" \t \t \t LEP Tutorials \n \n \n "; cout<<" Enter Your Name : "; cin>>name; if ((GetKeyState(VK_CAPITAL) & 0x0001)!=0) { cout<<(" \t \n WARNING! Caps Lock ON \n \n "); cout<<" Enter Password : "; } cin>>password; }
0 comments:
Post a Comment