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.

112 lines
2.8 KiB

  1. #ifndef __EMAIL_CONFIG_PAGE_H_
  2. #define __EMAIL_CONFIG_PAGE_H_
  3. #include "resource.h"
  4. //#include <atlsnap.h>
  5. #include "..\..\inc\atlsnap.h"
  6. #include <atlapp.h>
  7. #include <atlctrls.h>
  8. #include <faxmmc.h>
  9. #include <faxutil.h>
  10. #include <fxsapip.h>
  11. #include <RoutingMethodConfig.h>
  12. class CEmailConfigPage : public CSnapInPropertyPageImpl<CEmailConfigPage>
  13. {
  14. public :
  15. CEmailConfigPage(LONG_PTR lNotifyHandle, bool bDeleteHandle = false, TCHAR* pTitle = NULL ) :
  16. m_lNotifyHandle(lNotifyHandle),
  17. m_bDeleteHandle(bDeleteHandle) // Should be true for only page.
  18. {
  19. m_hFax = NULL;
  20. m_fIsDialogInitiated = FALSE;
  21. m_fIsDirty = FALSE;
  22. }
  23. HRESULT Init(LPCTSTR lpctstrServerName, DWORD dwDeviceId);
  24. ~CEmailConfigPage()
  25. {
  26. DEBUG_FUNCTION_NAME(TEXT("CEmailConfigPage::~CEmailConfigPage"));
  27. if (m_hFax)
  28. {
  29. if (!FaxClose(m_hFax))
  30. {
  31. DWORD ec = GetLastError();
  32. DebugPrintEx(
  33. DEBUG_ERR,
  34. TEXT("FaxClose() failed on fax handle (0x%08X : %s). (ec: %ld)"),
  35. m_hFax,
  36. m_bstrServerName,
  37. ec);
  38. }
  39. m_hFax = NULL;
  40. }
  41. if (m_bDeleteHandle)
  42. {
  43. MMCFreeNotifyHandle(m_lNotifyHandle);
  44. }
  45. }
  46. enum { IDD = IDD_EMAIL };
  47. BEGIN_MSG_MAP(CEmailConfigPage)
  48. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog )
  49. MESSAGE_HANDLER(WM_CONTEXTMENU, OnHelpRequest)
  50. MESSAGE_HANDLER(WM_HELP, OnHelpRequest)
  51. CHAIN_MSG_MAP(CSnapInPropertyPageImpl<CEmailConfigPage>)
  52. COMMAND_HANDLER(IDC_EDIT_MAILTO, EN_CHANGE, OnFieldChange)
  53. END_MSG_MAP()
  54. HRESULT PropertyChangeNotify(long param)
  55. {
  56. return MMCPropertyChangeNotify(m_lNotifyHandle, param);
  57. }
  58. BOOL OnApply();
  59. LRESULT OnFieldChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  60. {
  61. if (!m_fIsDialogInitiated) //event receieved in too early stage
  62. {
  63. return 0;
  64. }
  65. else
  66. {
  67. m_fIsDirty = TRUE;
  68. SetModified(TRUE);
  69. return 0;
  70. }
  71. }
  72. LRESULT OnInitDialog(
  73. UINT uiMsg,
  74. WPARAM wParam,
  75. LPARAM lParam,
  76. BOOL& fHandled );
  77. LRESULT OnHelpRequest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  78. public:
  79. LONG_PTR m_lNotifyHandle;
  80. bool m_bDeleteHandle;
  81. private:
  82. HANDLE m_hFax; // Handle to fax server connection
  83. CComBSTR m_bstrServerName;
  84. DWORD m_dwDeviceId;
  85. CComBSTR m_bstrMailTo;
  86. //
  87. // Controls
  88. //
  89. CEdit m_edtMailTo;
  90. BOOL m_fIsDialogInitiated;
  91. BOOL m_fIsDirty;
  92. };
  93. #endif