Friday, 6 February 2015

Caps Lock State check before Password in C++

Structure of the Problem Requirements  

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 retrieve the state of different keys.There have virtual key codes corresponding to each key in the keyboard.

Source Code

using namespace std;
int main ()
string name;
string password;
cout<<" \t \t \t LEP Tutorials \n \n \n ";
cout<<" Enter Your Name : ";

if ((GetKeyState(VK_CAPITAL) & 0x0001)!=0)

cout<<(" \t \n WARNING! Caps Lock ON \n \n ");
cout<<" Enter Password : ";


Output of the Program

Caps Lock State check before Password in C++

Share it Please

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.


Post a Comment