Leaked source code of windows server 2003
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.

121 lines
3.3 KiB

  1. // ArchiveDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ConfigTest.h"
  5. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  6. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  7. #include "..\..\..\inc\fxsapip.h"
  8. #include "ArchiveDlg.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CArchiveDlg dialog
  16. CArchiveDlg::CArchiveDlg(HANDLE hFax, FAX_ENUM_MESSAGE_FOLDER Folder, CWnd* pParent /*=NULL*/)
  17. : CDialog(CArchiveDlg::IDD, pParent),
  18. m_hFax (hFax),
  19. m_Folder (Folder)
  20. {
  21. //{{AFX_DATA_INIT(CArchiveDlg)
  22. m_dwAgeLimit = 0;
  23. m_cstrFolder = _T("");
  24. m_dwHighWatermark = 0;
  25. m_dwLowWatermark = 0;
  26. m_bUseArchive = FALSE;
  27. m_bWarnSize = FALSE;
  28. //}}AFX_DATA_INIT
  29. }
  30. void CArchiveDlg::DoDataExchange(CDataExchange* pDX)
  31. {
  32. CDialog::DoDataExchange(pDX);
  33. //{{AFX_DATA_MAP(CArchiveDlg)
  34. DDX_Text(pDX, IDC_AGE_LIMIT, m_dwAgeLimit);
  35. DDX_Text(pDX, IDC_FOLDER, m_cstrFolder);
  36. DDX_Text(pDX, IDC_HIGH_WM, m_dwHighWatermark);
  37. DDX_Text(pDX, IDC_LOW_WM, m_dwLowWatermark);
  38. DDX_Check(pDX, IDC_USE, m_bUseArchive);
  39. DDX_Check(pDX, IDC_WARN, m_bWarnSize);
  40. //}}AFX_DATA_MAP
  41. }
  42. BEGIN_MESSAGE_MAP(CArchiveDlg, CDialog)
  43. //{{AFX_MSG_MAP(CArchiveDlg)
  44. ON_BN_CLICKED(IDC_READ, OnRead)
  45. ON_BN_CLICKED(IDC_WRITE, OnWrite)
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CArchiveDlg message handlers
  50. void CArchiveDlg::OnRead()
  51. {
  52. PFAX_ARCHIVE_CONFIG pCfg;
  53. if (!FaxGetArchiveConfiguration (m_hFax, m_Folder, &pCfg))
  54. {
  55. CString cs;
  56. cs.Format ("Failed while calling FaxGetArchiveConfiguration (%ld)", GetLastError());
  57. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  58. return;
  59. }
  60. m_dwAgeLimit = pCfg->dwAgeLimit;
  61. m_cstrFolder = pCfg->lpcstrFolder;
  62. m_dwHighWatermark = pCfg->dwSizeQuotaHighWatermark;
  63. m_dwLowWatermark = pCfg->dwSizeQuotaLowWatermark;
  64. m_bUseArchive = pCfg->bUseArchive;
  65. m_bWarnSize = pCfg->bSizeQuotaWarning;
  66. UpdateData (FALSE);
  67. FaxFreeBuffer (LPVOID(pCfg));
  68. }
  69. void CArchiveDlg::OnWrite()
  70. {
  71. UpdateData ();
  72. FAX_ARCHIVE_CONFIG cfg;
  73. cfg.dwSizeOfStruct = sizeof (FAX_ARCHIVE_CONFIG);
  74. cfg.dwAgeLimit = m_dwAgeLimit;
  75. cfg.lpcstrFolder = LPTSTR(LPCTSTR(m_cstrFolder));
  76. cfg.dwSizeQuotaHighWatermark = m_dwHighWatermark;
  77. cfg.dwSizeQuotaLowWatermark = m_dwLowWatermark;
  78. cfg.bUseArchive = m_bUseArchive;
  79. cfg.bSizeQuotaWarning = m_bWarnSize;
  80. if (!FaxSetArchiveConfiguration (m_hFax, m_Folder, &cfg))
  81. {
  82. CString cs;
  83. cs.Format ("Failed while calling FaxSetArchiveConfiguration (%ld)", GetLastError());
  84. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  85. return;
  86. }
  87. }
  88. BOOL CArchiveDlg::OnInitDialog()
  89. {
  90. CDialog::OnInitDialog();
  91. if (m_Folder == FAX_MESSAGE_FOLDER_INBOX)
  92. {
  93. SetWindowText ("Inbox archive configuration test");
  94. }
  95. else
  96. {
  97. SetWindowText ("SentItems archive configuration test");
  98. }
  99. return TRUE; // return TRUE unless you set the focus to a control
  100. // EXCEPTION: OCX Property Pages should return FALSE
  101. }