I work in a public place where I have to deal with NT 4.0 machines and I can't be logging in and out manually all the time so I was wondering if anyone could help me create a program that would use a username and pass to get out of the program. I am a newb to programming and on chapter 2 of Beginning C++ Game Programming.
Currently I have a makeshift program that passlocks it in fullscreen mode and doesn't display the text whilst typing the pass but you can get around it by using alt enter. Is there any way to stop that?
Heres what I have to far:
Code:
//Roarke Password Lock
#include <iostream>
#include <windows.h>
#include <string>
#include <stdlib.h>
using namespace std;
void fullscreen()
{
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
}
int main()
{
fullscreen();
int leave = 0;
while (leave == 0)
{
system("CLS");
cout << "\n\tRoarkes Computer Passlock.";
string user, pass;
cout << "\n\nUsername: ";
cin >> user;
cout << "\nPassword: ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x0000);
cin >> pass;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x0007);
if((user == "Herc" && pass == "testing") || (user == "NumBer2" && pass == "hello"))
{
cout << "\n\n\t\tAccepted. Thank you."<<endl;
system("PAUSE");
break;
}
else
continue;
}
return 0;
}
Any ideas?
Yes, I picked up the fullscreen and the hide pass from these forums.
No, it doesn't have to be portable just has to work on 95/nt4workstation/98/xp/200/me.. basically all windows. Thanks