How do you make a password gate in a windows program?
This is a discussion on Password gate within the Windows Programming forums, part of the Platform Specific Boards category; How do you make a password gate in a windows program?...
How do you make a password gate in a windows program?
What's a password gate?
"If you tell the truth, you don't have to remember anything"
-Mark Twain
I'm just going to guess what you mean by 'password gate'..
Here is some code I just threw together as an example of console password input. This code will most likely contain bugs, but it should give you the general idea.
It's quite possible I missunderstood what 'password gate' meant, if I did, just ignore this whole postCode:#include <iostream> #include <conio.h> using namespace std; bool GetPassword(char * CorrectPass, int PassMaxLength) { char * str = new char[PassMaxLength+1]; char chr; int InputCounter = 0; do { chr = getch(); if(chr == (char)8) { if(InputCounter == 0) continue; InputCounter--; cout << (char)8 << " " << (char)8; } else if(chr != '\r') { str[InputCounter] = chr; cout << "*"; InputCounter++; } } while(InputCounter < PassMaxLength && chr != '\r'); str[InputCounter] = '\0'; if(strcmp(str,CorrectPass) == 0) {delete[] str; return true;} delete[] str; return false; } int main() { cout << "Password: "; if(GetPassword("password",100) == true) cout << "\nCorrect Password!" << endl; else cout << "\nYou Suck!" << endl; return 0; }![]()
r1ck0r has the right idea, but it's not windows, it's DOS.
Below is an example of a password gate.
There is a 'Windows Programming' section on this forum, this question would've been more suited there. Anyway, this link: http://www.winprog.net/ will give you an introduction into windows programming.