1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
void GeneratePW(HWND hwnd) {
const char* pw;
int length;
char length_char[256];
int leng;
char number[500];
string pw_string;
string chara = "abcdefghijklmnopqrstuvwxyz";
leng = GetWindowTextLength(hwndEdit2);
GetWindowText(hwndEdit2, length_char, leng);
//length = ctoi(length_char);
sscanf(length_char, "%d", &length);
itoa(length, number, 10);
MessageBox(NULL,number,"Password Generator",MB_ICONWARNING | MB_OK);
if(length > 100) {
MessageBox(NULL,"Too many characters!","Password Generator",MB_ICONWARNING | MB_OK);
} else {
if(IsDlgButtonChecked(hwnd, ID_CHECKBOX)) {
chara += "0123456789";
}
if(IsDlgButtonChecked(hwnd, ID_CHECKBOX2)) {
chara += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
pw_string = random(10, chara); //if it will work I will pass the int here
pw = pw_string.c_str();
SetWindowText(hwndEdit, pw);
}
}
|