2 * Copyright (C) 1998 Transarc Corporation.
9 * INCLUDES ___________________________________________________________________
13 #include <afs/param.h>
17 #include "afscfg.h" // Main header for this application
19 #include "get_pw_dlg.h"
23 * DEFINITIONS _________________________________________________________________
26 static HWND hDlg = 0; // HWND for this page's dialog
30 * PROTOTYPES _________________________________________________________________
33 static void OnInitDialog(HWND hwndDlg);
34 static void CheckEnableButtons();
35 static void SaveDlgInfo();
36 static void ShowPageInfo();
38 BOOL CALLBACK GetPwDlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
42 * EXPORTED FUNCTIONS _________________________________________________________
45 BOOL GetAfsPrincipalPassword(HWND hParent, TCHAR *&pszServerPW)
47 int nResult = ModalDialog(IDD_GET_PW, hParent, (DLGPROC)GetPwDlgProc);
48 if (nResult == IDOK) {
49 pszServerPW = g_CfgData.szServerPW;
60 * Dialog Proc _________________________________________________________________
63 BOOL CALLBACK GetPwDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
65 if (AfsAppLib_HandleHelp(IDD_GET_PW, hwndDlg, msg, wp, lp))
70 OnInitDialog(hwndDlg);
76 if (HIWORD(wp) == EN_CHANGE)
81 EndDialog(hDlg, IDCANCEL);
87 EndDialog(hDlg, IDOK);
98 * STATIC FUNCTIONS _________________________________________________________________
103 * Event Handler Functions _________________________________________________________________
106 static void OnInitDialog(HWND hwndDlg)
113 * Utility Functions _________________________________________________________________
116 static void CheckEnableButtons()
118 BOOL bDisable = FALSE;
120 TCHAR szDummy[cchRESOURCE];
122 bDisable |= lstrlen(GetWndText(hDlg, IDC_PW, szDummy)) == 0;
124 SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
127 static void SaveDlgInfo()
129 TCHAR szText[cchRESOURCE];
131 lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_PW, szText), MAX_SERVER_PW_LEN);
134 static void ShowPageInfo()
136 SetWndText(hDlg, IDC_PW, g_CfgData.szServerPW);