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 43 44
|
int WINAPI GetWindowText(
_In_ HWND hWnd,
_Out_ LPTSTR lpString,
_In_ int nMaxCount
);
HWND login(HWND hwnd){
HWND hWindow;
TCHAR id [5], password [5];
const int defaultid=12345;
const int defaultpassword=23456;
hWindow = CreateWindowA("Static","Welcome!",
WS_CHILD | WS_VISIBLE ,1,1,500,100,hwnd,
HMENU)NULL,NULL,NULL);
hWindow = CreateWindow("Static","Username: ",
WS_CHILD | WS_VISIBLE ,1,50,550,100,hwnd,
(HMENU)NULL,NULL,NULL);
hWindow = CreateWindow("EDIT", "",
WS_VISIBLE | WS_CHILD | WS_BORDER,
80,50,80,20,
hwnd, (HMENU) ID_BUTTON, NULL, NULL
);
id=GetWindowText(hwnd,LPSTR,5);
hWindow = CreateWindow("Static","Password: ",
WS_CHILD | WS_VISIBLE ,1,90,550,100,hwnd,
(HMENU)NULL,NULL,NULL);
hWindow = CreateWindow("EDIT", "",
WS_VISIBLE | WS_CHILD | ES_PASSWORD | WS_BORDER,
80,90,80,20, hwnd, (HMENU) ID_BUTTON, NULL, NULL
);
password=GetWindowText(hwnd,LPSTR,5);
hWindow = CreateWindow("BUTTON", "LOGIN",
WS_VISIBLE | WS_CHILD | WS_BORDER,
80,130,80,20,
hwnd, (HMENU) ID_BUTTON, NULL, NULL
);
if (id==defaultid&&password==defaultpassword){
hWindow= CreateWindow("Static","Log-in succesful! ",
WS_CHILD | WS_VISIBLE ,1,90,550,100,hwnd,
(HMENU)NULL,NULL,NULL);
}
}
|