summaryrefslogtreecommitdiff
path: root/protocols/Xfire/src/pwd_dlg.cpp
blob: ee0ce90be08972da379e8d42bd1578c99f687682 (plain)
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
45
46
47
48
49
50
51
52
53
//fürs nick - dialog

#include "stdafx.h"
#include "pwd_dlg.h"

char password[256]="";

LRESULT CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg)
	{
		case WM_INITDIALOG:
		{
			SetWindowText(hwndDlg, "Please enter server password ...");
			TranslateDialogDefault(hwndDlg);
			SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
			return TRUE;
		}
		case WM_COMMAND:
		{
			if(LOWORD(wParam) == IDOK)
			{
				GetDlgItemText(hwndDlg,IDC_NICKNAME,password,sizeof(password));
				EndDialog(hwndDlg,TRUE);
				return TRUE;
			}
			else if(LOWORD(wParam) == IDCANCEL)
			{
				EndDialog(hwndDlg,FALSE);
				return FALSE;
			}
		}
	}
	return FALSE;
}

BOOL ShowPwdDlg(char* pw) {
	//kein gültiges ziel für das eingegebene passwort
	if(&pw==NULL)
		return FALSE;
	
	if(DialogBox(hinstance,MAKEINTRESOURCE(IDD_SETNICKNAME),NULL,DlgPwProc))
	{
		//passwort kopieren
		if(*password == 0)
			return FALSE;

		strcpy_s(pw,255,password);
		return TRUE;
	}

	return FALSE;
}