Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: credui.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. //////////////////////////////////////////////////////////
  11. // credui.cpp
  12. #include "pch.h"
  13. #include <SnapBase.h>
  14. #include "resource.h"
  15. #include "editor.h"
  16. #include "credui.h"
  17. #ifdef DEBUG_ALLOCATOR
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. #endif
  24. BEGIN_MESSAGE_MAP(CCredentialDialog, CDialog)
  25. END_MESSAGE_MAP()
  26. CCredentialDialog::CCredentialDialog(CCredentialObject* pCredObject,
  27. LPCWSTR lpszConnectName,
  28. CWnd* pCWnd)
  29. : CDialog(IDD_CREDENTIAL_DIALOG, pCWnd)
  30. {
  31. m_sConnectName = lpszConnectName;
  32. m_pCredObject = pCredObject;
  33. }
  34. CCredentialDialog::~CCredentialDialog()
  35. {
  36. }
  37. BOOL CCredentialDialog::OnInitDialog()
  38. {
  39. CDialog::OnInitDialog();
  40. CEdit* pUserBox = (CEdit*) GetDlgItem(IDC_USERNAME);
  41. CEdit* pPassBox = (CEdit*) GetDlgItem(IDC_PASSWORD);
  42. CStatic* pConnectStatic = (CStatic*) GetDlgItem(IDC_CONNECTION_STATIC);
  43. CString sUsername;
  44. m_pCredObject->GetUsername(sUsername);
  45. pUserBox->SetWindowText(sUsername);
  46. CString sStatic;
  47. pConnectStatic->GetWindowText(sStatic);
  48. sStatic += m_sConnectName + _T("\":");
  49. pConnectStatic->SetWindowText(sStatic);
  50. pPassBox->SetLimitText(MAX_PASSWORD_LENGTH);
  51. return TRUE;
  52. }
  53. void CCredentialDialog::OnOK()
  54. {
  55. CEdit* pUserBox = (CEdit*) GetDlgItem(IDC_USERNAME);
  56. CEdit* pPassBox = (CEdit*) GetDlgItem(IDC_PASSWORD);
  57. CString sUsername;
  58. pUserBox->GetWindowText(sUsername);
  59. HWND hWnd = pPassBox->GetSafeHwnd();
  60. m_pCredObject->SetUsername(sUsername);
  61. m_pCredObject->SetPasswordFromHwnd(hWnd);
  62. CDialog::OnOK();
  63. }