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.

115 lines
3.1 KiB

  1. #ifndef __STORE_CONFIG_PAGE_H_
  2. #define __STORE_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 CStoreConfigPage : public CSnapInPropertyPageImpl<CStoreConfigPage>
  13. {
  14. public :
  15. CStoreConfigPage(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. ~CStoreConfigPage()
  25. {
  26. DEBUG_FUNCTION_NAME(TEXT("CStoreConfigPage::~CStoreConfigPage"));
  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_STORE };
  47. BEGIN_MSG_MAP(CStoreConfigPage)
  48. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog )
  49. MESSAGE_HANDLER(WM_CONTEXTMENU, OnHelpRequest)
  50. MESSAGE_HANDLER(WM_HELP, OnHelpRequest)
  51. CHAIN_MSG_MAP(CSnapInPropertyPageImpl<CStoreConfigPage>)
  52. COMMAND_HANDLER(IDC_EDIT_FOLDER, EN_CHANGE, OnFieldChange)
  53. COMMAND_HANDLER(IDC_BUT_BROWSE, BN_CLICKED, OnBrowseForFolder)
  54. END_MSG_MAP()
  55. LRESULT OnBrowseForFolder(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  56. HRESULT PropertyChangeNotify(long param)
  57. {
  58. return MMCPropertyChangeNotify(m_lNotifyHandle, param);
  59. }
  60. BOOL OnApply();
  61. LRESULT OnFieldChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  62. {
  63. if (!m_fIsDialogInitiated) //event receieved in too early stage
  64. {
  65. return 0;
  66. }
  67. else
  68. {
  69. m_fIsDirty = TRUE;
  70. SetModified(TRUE);
  71. return 0;
  72. }
  73. }
  74. LRESULT OnInitDialog(
  75. UINT uiMsg,
  76. WPARAM wParam,
  77. LPARAM lParam,
  78. BOOL& fHandled );
  79. LRESULT OnHelpRequest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  80. public:
  81. LONG_PTR m_lNotifyHandle;
  82. bool m_bDeleteHandle;
  83. static CComBSTR &GetFolder () { return m_bstrFolder; }
  84. private:
  85. HANDLE m_hFax; // Handle to fax server connection
  86. CComBSTR m_bstrServerName;
  87. DWORD m_dwDeviceId;
  88. static CComBSTR m_bstrFolder; // We're refering to this variable in the callback function BrowseCallbackProc
  89. //
  90. // Controls
  91. //
  92. CEdit m_edtFolder;
  93. BOOL m_fIsDialogInitiated;
  94. BOOL m_fIsDirty;
  95. };
  96. #endif