-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPasswordDialog.cpp
59 lines (52 loc) · 1.37 KB
/
PasswordDialog.cpp
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
54
55
56
57
58
59
#include "stdafx.h"
#include "resource.h"
#include "NotesIPass.h"
extern HINSTANCE hDllInstance;
/* Windows dialog proc to obtain password */
BOOL CALLBACK PasswordDlgProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
WORD wNotify;
WORD wID;
HWND hControl;
UINT ret;
static EXT_DLG_DATA* data;
switch (uMsg)
{
case WM_INITDIALOG:
data = (EXT_DLG_DATA*)lParam;
SetDlgItemText(hWndDlg, IDC_USERNAME, data->OwnerName);
SetDlgItemText(hWndDlg, IDC_FILEPATH, data->FileName);
SendDlgItemMessage(hWndDlg, IDC_PASSWORD, WM_SETFOCUS, 0, 0);
return TRUE;
case WM_COMMAND:
wNotify = HIWORD(wParam);
wID = LOWORD(wParam);
hControl = (HWND)lParam;
switch (wID)
{
case IDOK:
ret = GetDlgItemText(hWndDlg, IDC_PASSWORD, data->retPassword, data->MaxPwdLen);
if (0 != ret){
EndDialog(hWndDlg, IDOK);
}
else {
*(data->retPassword) = '\0';
EndDialog(hWndDlg, IDABORT);
}
return (TRUE);
case IDCANCEL:
*(data->retPassword) = '\0';
EndDialog(hWndDlg, IDCANCEL);
return (TRUE);
}
return (FALSE);
}
return (FALSE);
}
UINT PasswordDialog(EXT_DLG_DATA* data) {
FARPROC lpfnPasswordDlgProc;
lpfnPasswordDlgProc = MakeProcInstance(
(FARPROC)PasswordDlgProc,
hDllInstance);
UINT result = DialogBoxParam(hDllInstance, MAKEINTRESOURCE(IDD_FORMVIEW), HWND_DESKTOP, (DLGPROC)lpfnPasswordDlgProc, (LPARAM)(data));
return result;
}