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.

170 lines
4.7 KiB

  1. #ifndef __ROUTE_H_
  2. #define __ROUTE_H_
  3. #include "resource.h"
  4. #include "atlsnap.h"
  5. #include <winfax.h>
  6. #include <winfaxp.h>
  7. #include <shlobj.h>
  8. #define MAX_STRING_LEN 128
  9. #define MAX_TITLE_LEN 60
  10. #define MAX_MESSAGE_LEN 256
  11. #define MAX_ARCHIVE_DIR (MAX_PATH - 16)
  12. #define RM_EMAIL 0
  13. #define RM_INBOX 1
  14. #define RM_FOLDER 2
  15. #define RM_PRINT 3
  16. #define RM_COUNT 4 // number of routing methods
  17. #define FAX_DRIVER_NAME L"Windows NT Fax Driver"
  18. #define MAPIENABLED (m_MapiProfiles && *m_MapiProfiles)
  19. class CRoutePage : public CPropertyPageImpl<CRoutePage>
  20. {
  21. HANDLE m_FaxHandle;
  22. HANDLE m_PortHandle;
  23. DWORD m_DeviceId;
  24. BOOL m_bChanged;
  25. WCHAR m_Title[MAX_TITLE_LEN];
  26. WCHAR m_ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
  27. PFAX_ROUTING_METHOD m_RoutingMethods[RM_COUNT];
  28. PFAX_ROUTING_METHOD m_BaseMethod;
  29. LPBYTE m_RoutingInfo[RM_COUNT];
  30. DWORD m_RoutingInfoSize[RM_COUNT];
  31. LPBYTE m_MapiProfiles;
  32. VOID SystemErrorMsg( DWORD ErrorCode );
  33. VOID EnumMapiProfiles( HWND hwnd );
  34. VOID SetChangedFlag( BOOL Flag );
  35. INT DisplayMessageDialog( INT TitleId, INT MsgId, UINT Type = MB_OK | MB_ICONERROR );
  36. BOOL BrowseForDirectory( );\
  37. public :
  38. CRoutePage(TCHAR* pTitle = NULL, HANDLE FaxHandle = NULL, DWORD DeviceId = NULL, LPWSTR ComputerName = NULL);
  39. enum { IDD = IDD_ROUTE };
  40. BEGIN_MSG_MAP(CRoutePage)
  41. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  42. MESSAGE_HANDLER(WM_HELP, OnWmHelp)
  43. MESSAGE_HANDLER(WM_CONTEXTMENU, OnWmContextHelp)
  44. COMMAND_ID_HANDLER(IDC_PRINT, OnPrint)
  45. COMMAND_ID_HANDLER(IDC_PRINT_TO, OnPrintTo)
  46. COMMAND_ID_HANDLER(IDC_SAVE, OnSaveTo)
  47. COMMAND_ID_HANDLER(IDC_INBOX, OnInbox)
  48. COMMAND_ID_HANDLER(IDC_EMAIL, OnEmail)
  49. COMMAND_ID_HANDLER(IDC_INBOX_PROFILE, OnProfile)
  50. COMMAND_ID_HANDLER(IDC_DEST_FOLDER, OnDestDir)
  51. COMMAND_ID_HANDLER(IDC_BROWSE_DIR, OnBrowseDir)
  52. CHAIN_MSG_MAP(CPropertyPageImpl<CRoutePage>)
  53. END_MSG_MAP()
  54. LRESULT OnPrint(INT code, INT id, HWND hwnd, BOOL& bHandled);
  55. LRESULT OnPrintTo(INT code, INT id, HWND hwnd, BOOL& bHandled);
  56. LRESULT OnSaveTo(INT code, INT id, HWND hwnd, BOOL& bHandled);
  57. LRESULT OnInbox(INT code, INT id, HWND hwnd, BOOL& bHandled);
  58. LRESULT OnEmail(INT code, INT id, HWND hwnd, BOOL& bHandled);
  59. LRESULT OnProfile(INT code, INT id, HWND hwnd, BOOL& bHandled);
  60. LRESULT OnDestDir(INT code, INT id, HWND hwnd, BOOL& bHandled);
  61. LRESULT OnBrowseDir(INT code, INT id, HWND hwnd, BOOL& bHandled);
  62. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  63. LRESULT OnWmHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  64. LRESULT OnWmContextHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  65. BOOL OnApply();
  66. };
  67. class CRouteData : public CSnapInDataInterface< CRouteData, TRUE >
  68. {
  69. static const GUID* m_NODETYPE;
  70. static const TCHAR* m_SZNODETYPE;
  71. static const TCHAR* m_SZDISPLAY_NAME;
  72. static const CLSID* m_SNAPIN_CLASSID;
  73. public:
  74. static CComPtr<IControlbar> m_spControlBar;
  75. public:
  76. CRouteData()
  77. {
  78. }
  79. ~CRouteData()
  80. {
  81. }
  82. STDMETHOD(CreatePropertyPages)(
  83. LPPROPERTYSHEETCALLBACK lpProvider,
  84. LONG_PTR handle,
  85. IUnknown* pUnk
  86. );
  87. STDMETHOD(QueryPagesFor)(void)
  88. {
  89. return S_OK;
  90. }
  91. void* GetNodeType()
  92. {
  93. return (void*)m_NODETYPE;
  94. }
  95. void* GetSZNodeType()
  96. {
  97. return (void*)m_SZNODETYPE;
  98. }
  99. void* GetDisplayName()
  100. {
  101. return (void*)m_SZDISPLAY_NAME;
  102. }
  103. void* GetSnapInCLSID()
  104. {
  105. return (void*)m_SNAPIN_CLASSID;
  106. }
  107. IDataObject* m_pDataObject;
  108. BOOL InitDataClass(IDataObject* pDataObject)
  109. {
  110. m_pDataObject = pDataObject;
  111. // The default code stores off the pointer to the Dataobject the class is wrapping
  112. // at the time.
  113. // Alternatively you could convert the dataobject to the internal format
  114. // it represents and store that information
  115. return TRUE;
  116. }
  117. };
  118. class CRoute : public CSnapinObjectRootEx<CComSingleThreadModel>,
  119. public IExtendPropertySheetImpl<CRoute>,
  120. public CComCoClass<CRoute, &CLSID_Route>
  121. {
  122. public:
  123. EXTENSION_SNAPIN_DATACLASS(CRouteData)
  124. BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP(CRoute)
  125. EXTENSION_SNAPIN_NODEINFO_ENTRY(CRouteData)
  126. END_EXTENSION_SNAPIN_NODEINFO_MAP()
  127. BEGIN_COM_MAP(CRoute)
  128. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  129. END_COM_MAP()
  130. DECLARE_REGISTRY_RESOURCEID(IDR_ROUTE)
  131. DECLARE_NOT_AGGREGATABLE(CRoute)
  132. };
  133. #endif