home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / mapi / win16 / dev / mdbview / mdbview.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-11  |  14.6 KB  |  609 lines

  1. /*********************************************************************/
  2. /*
  3.  -  mdbview.h
  4.  -  Copyright (C) 1995 Microsoft Corporation
  5.  -
  6.  *  Purpose:
  7.  *      Defines id's, function prototypes, classes for mdbview
  8.  *      Classes for Setting Property dialog, Main Window, Application,
  9.  *      and property display dialog are all defined in this header.
  10.  */
  11. /*********************************************************************/
  12.  
  13. #ifndef __mdbview_h_
  14. #define __mdbview_h_
  15.  
  16. // Undefine XVPORT in order to remove dependency.
  17. #define XVPORT
  18.  
  19. /******************** Utility/Tool Function Prototypes ***************/
  20.  
  21. void FreeAdrList( LPADRLIST lpadrlist );
  22.  
  23. /******************** Application Defines ****************************/
  24.  
  25. // listbox sizes
  26.  
  27. #define MSG_LISTBOX_HORIZONTAL_SIZE     2000
  28. #define PROP_LISTBOX_HORIZONTAL_SIZE    2000
  29. #define PROP_LISTBOX_TAB1_SIZE          120
  30. #define PROP_LISTBOX_TAB2_SIZE          185
  31. #define MAPILOG_LISTBOX_TAB1_SIZE       250
  32.  
  33.  
  34. // Message Box Styles 
  35.  
  36. #define MBS_ERROR                       (MB_ICONSTOP | MB_OK )
  37. #define MBS_INFO                        (MB_ICONINFORMATION | MB_OK)
  38. #define MBS_OOPS                        (MB_ICONEXCLAMATION | MB_OK)
  39.  
  40. // application window size 
  41.    
  42. #define MW_LEFT                         5
  43. #define MW_TOP                          5
  44. #define MW_RIGHT                        500
  45. #define MW_BOTTOM                       200
  46.  
  47.  
  48. #define MAX_LOG_BUFF                    255 // for displaying PT_BINARY
  49.  
  50. #define COMMENT_SIZE                    3000
  51.  
  52.  
  53. // focus of button enables/disables
  54.  
  55. #define FOCUS_PROPERTY                  6
  56. #define FOCUS_MESSAGE                   7
  57. #define FOCUS_ATTACH                    8
  58. #define FOCUS_FOLDER                    9
  59. #define FOCUS_NONE                      10
  60.  
  61. /*********************************************************************/
  62.  
  63. // used to keep track of one Advise on object
  64. typedef struct _Connect
  65. {
  66.     ULONG       ulConnection;           // connection number returned from Advise
  67.     char        szContext[256];          // description of connection lpvContext
  68. } CONNECT, *LPCONNECT;
  69.  
  70. // used to keep track of all the Advises an object Registers
  71. typedef struct _Notifs
  72. {
  73.     ULONG       cConnect;               // number of current Advises Registerd on object
  74.     CONNECT     Connect[25];            // pointer to an array of     
  75. } NOTIFS, *LPNOTIFS;
  76.  
  77. void    AdviseObj(  LPUNKNOWN       lpUnk,
  78.                     ULONG           ulObjType, 
  79.                     LPNOTIFCALLBACK lpfnNotifCallback,
  80.                     ULONG           ulEventType, 
  81.                     ULONG           cbEntryID,
  82.                     LPENTRYID       lpEntryID,
  83.                     LPSTR           lpszComment,
  84.                     LPVOID          lpvExplicitContext,
  85.                     LPNOTIFS FAR    *lppNotifs);
  86.  
  87. #ifdef XVPORT
  88. void AdviseAllStatusObjects(void);
  89. #endif
  90.  
  91. void UnadviseAll(   LPUNKNOWN       lpUnk,
  92.                     ULONG           ulObjType, 
  93.                     LPSTR           lpszDescription,
  94.                     LPNOTIFS FAR    *lppNotifs);
  95.  
  96. /******************** Class Definitions ******************************/
  97.  
  98. /*********************************************************************/
  99. /*
  100.  -  CGetError
  101.  -
  102.  *  Purpose:
  103.  *      Defines the methods to Get Error Strings.
  104.  *
  105.  */
  106. /*********************************************************************/
  107.  
  108. class CGetError
  109. {
  110.     private:
  111.         char    m_szMessage[COMMENT_SIZE];      // this is so notification will work/display correctly
  112.         char    m_szResult[80];
  113.         char    m_szBuffer[80];
  114.  
  115.     public:
  116.         CGetError()
  117.         {
  118.             m_szMessage[0]  = '\0';
  119.             m_szResult[0]   = '\0';
  120.         };
  121.  
  122.         ~CGetError() { };           
  123.  
  124. #ifdef WIN16
  125.         LPSTR SzError( LPSTR, HRESULT );
  126. #endif
  127.         LPSTR SzError( LPSTR, SCODE );
  128. };
  129.  
  130. /*********************************************************************/
  131. /*
  132.  -  CMainWindow
  133.  -
  134.  *  Purpose:
  135.  *      Defines an Object that holds all the info needed for the CLNT's
  136.  *      main window.  
  137.  *
  138.  */
  139. /*********************************************************************/
  140.  
  141. class CMainWindow : public CFrameWnd
  142. {
  143. protected:
  144.     void ToggleMenu(BOOL bState);
  145.     
  146. public:
  147.     afx_msg void OnAbout(); 
  148.     afx_msg void OnExit();
  149.     afx_msg void OnClose(); 
  150.     afx_msg void OnLogon(); 
  151.     afx_msg void OnLogoff();
  152.     afx_msg void OnOpenMDB(); 
  153.     afx_msg void OnMDBProps(); 
  154.     afx_msg void OnABProps(); 
  155.     afx_msg void OnMDBSupportMask(); 
  156.  
  157.  
  158.     afx_msg void OnIPMSubtree(); 
  159.     afx_msg void OnIPMOutbox(); 
  160.     afx_msg void OnIPMWasteBasket(); 
  161.     afx_msg void OnIPMSentMail(); 
  162.  
  163.  
  164.     afx_msg void OnGetReceiveFolder();
  165.     afx_msg void OnGetReceiveFolderTable();
  166.     afx_msg void OnGetStatusTable();
  167.     afx_msg void OnGetStoresTable();    
  168.     afx_msg void OnEnumAdrTypes();    
  169.     afx_msg void OnQueryIdentity();    
  170.     afx_msg void OnQueryDefaultMsgOptions();    
  171.     afx_msg void OnOpenRootFolder(); 
  172.     afx_msg void OnStoreLogoff(); 
  173.     afx_msg void OnOpenStatusObj(); 
  174.  
  175.     afx_msg void OnGetLastError(); 
  176.     afx_msg void OnAddress(); 
  177.     afx_msg void OnCreateOneOff(); 
  178.     afx_msg void OnQueryDefRecipOpts(); 
  179.     afx_msg void OnResolveName(); 
  180.     afx_msg void OnSessionRegNotif(); 
  181.     afx_msg void OnStatusRegNotif(); 
  182.     afx_msg void OnMDBRegNotif(); 
  183.     afx_msg void OnTableRegNotif(); 
  184.     afx_msg void OnABRegNotif(); 
  185.     afx_msg void OnNotifState();
  186.     
  187.     afx_msg void PostNcDestroy();
  188.  
  189.     DECLARE_MESSAGE_MAP()
  190. };
  191.     
  192. /*********************************************************************/
  193. /*
  194.  -  CTheApp
  195.  -
  196.  *  Purpose:
  197.  *      Defines an Object that holds all the info needed for the MDBViewer
  198.  *      Application.  
  199.  *
  200.  */
  201. /*********************************************************************/
  202.  
  203. class CTheApp : public CWinApp
  204. {
  205. protected:               
  206.     CMainWindow m_MainWnd;
  207.  
  208. public:
  209.     BOOL    InitInstance();
  210.     int     ExitInstance();
  211.     
  212. };
  213.  
  214. /*********************************************************************/
  215. /*
  216.  -  CPropDlg Class
  217.  -
  218.  *  Purpose:
  219.  *      Defines the controls for the Dialogs with Properties
  220.  *      This class is the base class for all LPMAPIPROP dialogs
  221.  *      it defines common preperty display and property setting functions
  222.  *      for all LPMAPIPROP objects in the message store.  The objects
  223.  *      That inherit from this class are Folder, Message, and Attachment.
  224.  *
  225.  */
  226. /*********************************************************************/
  227.  
  228. class CPropDlg : public CDialog
  229. {
  230. public:
  231.     LPMAPIPROP  m_lpEntry;          
  232.     char        m_szLogBuf[512];    // used for MAPI log window output
  233.     char        m_szError[80];      // used for passing into GetString for MAPIErrors
  234.     HRESULT     m_hResult;
  235.     CGetError   m_E;
  236.  
  237.     CPropDlg(   LPMAPIPROP  lpEntry,
  238.                 UINT        Prop, 
  239.                 CWnd        *pParentWnd)
  240.             : CDialog(Prop,  pParentWnd) 
  241.         {
  242.             m_lpEntry   = lpEntry;
  243.             m_hResult   = hrSuccess;
  244.  
  245.             if( ! Create(Prop,NULL) )         // create dialog here
  246.             {
  247.                 MessageBox("CreateDialog Failed","Client",MBS_ERROR);           
  248.                 delete this;
  249.             }
  250.         }
  251.     
  252.     ~CPropDlg() {  }
  253.  
  254.     // displaying properties
  255.     virtual void OnProperty()       = 0;        
  256.     virtual void OnCallFunction()   = 0;
  257.     virtual void OnSpecialProps()   = 0;
  258.     virtual void OnPropInterface()  = 0;
  259.     
  260.     void OnType();  
  261.     void OnValues();
  262.     void OnData();  
  263.     void OnString();   
  264.     void OnHex();
  265.     void OnDecimal();    
  266.     void RedrawPropTable();             
  267.     void ResetPropButtons();          
  268.  
  269.     void OnClearMapiLog();                
  270.  
  271.     // property operations
  272.     void Stub();                        // generic NYI message
  273.     void OnSave();                  
  274.     void OnSetProps();
  275.     void OnDeleteProp();
  276. };
  277.  
  278.  
  279. /*********************************************************************/
  280. /*
  281.  -  COpenStoreDlg Class
  282.  -
  283.  *  Purpose:
  284.  *      Defines the controls for the Open Store Dialog
  285.  *
  286.  */
  287. /*********************************************************************/
  288.  
  289. class COpenStoreDlg : public CModalDialog
  290. {
  291. public:
  292.     LPMAPITABLE     m_lptblStores;
  293.     LPSRowSet       m_lpRows;
  294.  
  295.     COpenStoreDlg(CWnd * pParentWnd)
  296.         : CModalDialog(STORELOGON, pParentWnd)
  297.     {
  298.         m_lptblStores   = NULL;
  299.         m_lpRows        = NULL;
  300.     }
  301.  
  302.     ~COpenStoreDlg();   
  303.  
  304.     BOOL OnInitDialog();
  305.  
  306.     void OnOpen();
  307.     void OnReadOnly();  
  308.     void DisplayStores();   
  309.     void OnSetDefaultStore();
  310.     void OnCancel();
  311.     
  312.     DECLARE_MESSAGE_MAP();
  313. };
  314.  
  315.  
  316. /*********************************************************************/
  317. /*
  318.  -  CStoreSupportMaskDlg
  319.  -
  320.  *  Purpose:
  321.  *      Defines the controls for the GetPropList Property Dialog
  322.  *
  323.  */
  324. /*********************************************************************/
  325.  
  326. class CStoreSupportMaskDlg : public CModalDialog
  327. {
  328. public:
  329.  
  330.     ULONG           m_cVals;
  331.     LPSPropValue    m_lpspva;
  332.  
  333.     CStoreSupportMaskDlg(CWnd  *pParentWnd)
  334.         : CModalDialog(SUPPORTMASK, pParentWnd)
  335.     {
  336.         m_cVals     = 0;
  337.         m_lpspva    = NULL;
  338.     }
  339.  
  340.     ~CStoreSupportMaskDlg();    
  341.  
  342.     BOOL OnInitDialog();
  343.     void OnCancel();    
  344.  
  345. };
  346.  
  347.  
  348. /*********************************************************************/
  349. /*
  350.  -  CEnumAdrTypesDlg
  351.  -
  352.  *  Purpose:
  353.  *      Defines the controls for the GetPropList Property Dialog
  354.  *
  355.  */
  356. /*********************************************************************/
  357.  
  358. class CEnumAdrTypesDlg : public CModalDialog
  359. {
  360. public:
  361.  
  362.     LPTSTR  *m_lppszAdrTypes;
  363.  
  364.     CEnumAdrTypesDlg(CWnd  *pParentWnd)
  365.         : CModalDialog(IDC_ENUMADRTYPES, pParentWnd)
  366.     {
  367.         m_lppszAdrTypes       = NULL;
  368.     }
  369.  
  370.     ~CEnumAdrTypesDlg();    
  371.  
  372.     BOOL OnInitDialog();
  373.     
  374.     void OnCancel();    
  375.  
  376. };
  377.  
  378.  
  379. /*********************************************************************/
  380. /*
  381.  -  CQueryDefaultMsgOptsDlg
  382.  -
  383.  *  Purpose:
  384.  *      Defines the controls for the GetPropList Property Dialog
  385.  *
  386.  */
  387. /*********************************************************************/
  388.  
  389. class CQueryDefaultMsgOptsDlg : public CModalDialog
  390. {
  391. public:
  392.  
  393.     LPSPropValue    m_lpspva;
  394.     ULONG           m_cValues;    
  395.  
  396.     CQueryDefaultMsgOptsDlg(CWnd  *pParentWnd)
  397.         : CModalDialog(QUERYDEFAULTMSGOPTS, pParentWnd)
  398.     {
  399.         m_lpspva  = NULL;
  400.         m_cValues = 0;
  401.     }
  402.  
  403.     ~CQueryDefaultMsgOptsDlg(); 
  404.  
  405.     BOOL OnInitDialog();
  406.     
  407.     void OnCancel();    
  408. };
  409.       
  410.  
  411.  
  412. /*********************************************************************/
  413. /*
  414.  -  CEntryListDlg
  415.  -
  416.  *  Purpose:
  417.  *      Defines the controls for the Entryist dlg
  418.  *
  419.  */
  420. /*********************************************************************/
  421.  
  422. class CEntryListDlg : public CModalDialog
  423. {
  424. public:
  425.     
  426.     LPENTRYLIST     *m_lppEntryList;
  427.     CString         m_List;
  428.         
  429.     CEntryListDlg(CWnd  *pParentWnd)
  430.         : CModalDialog(ENTRYLIST, pParentWnd)
  431.     {
  432.         m_lppEntryList       = NULL;
  433.     }
  434.  
  435.     ~CEntryListDlg();   
  436.  
  437.     BOOL OnInitDialog();
  438.     
  439.     void OnCancel();    
  440.     void OnClearList();
  441.     
  442.     void DisplayList();
  443.  
  444.     DECLARE_MESSAGE_MAP();
  445.  
  446. };
  447.  
  448.  
  449.  
  450. /*********************************************************************/
  451. /*
  452.  -  CAdrListDlg
  453.  -
  454.  *  Purpose:
  455.  *      Defines the controls for the Entryist dlg
  456.  *
  457.  */
  458. /*********************************************************************/
  459.  
  460. class CAdrListDlg : public CModalDialog
  461. {
  462. public:
  463.     
  464.     LPADRLIST       m_lpAdrList;
  465.     CString         m_List;
  466.         
  467.     CAdrListDlg(CWnd  *pParentWnd)
  468.         : CModalDialog(ADRLIST, pParentWnd)
  469.     {
  470.         m_lpAdrList       = NULL;
  471.     }
  472.  
  473.     ~CAdrListDlg(); 
  474.  
  475.     BOOL OnInitDialog();
  476.     
  477.     void OnCancel();    
  478.     
  479.     void DisplayAdrList();
  480. };
  481.  
  482.       
  483.       
  484.  
  485.  
  486. /*********************************************************************/
  487. /*
  488.  -  CPropDisplayDlg
  489.  -
  490.  *  Purpose:
  491.  *      Defines the controls for the Entryist dlg
  492.  *
  493.  */
  494. /*********************************************************************/
  495.  
  496. class CPropDisplayDlg : public CModalDialog
  497. {
  498. public:
  499.     LPSPropValue    m_lpspva;
  500.     LPENTRYID       m_lpEntryID;
  501.     ULONG           m_ulValues;
  502.         
  503.     CString         m_List;
  504.         
  505.     CPropDisplayDlg(CWnd  *pParentWnd)
  506.         : CModalDialog(PROP_DISPLAY, pParentWnd)
  507.     {
  508.         m_lpspva        = NULL;
  509.         m_ulValues      = 0;
  510.         m_lpEntryID     = NULL;
  511.     }
  512.  
  513.     ~CPropDisplayDlg(); 
  514.  
  515.     BOOL OnInitDialog();
  516.     
  517.     void OnCancel();    
  518.     
  519.     void DisplayProps();
  520. };
  521.  
  522.  
  523. /*********************************************************************/
  524. /*
  525.  -  CNotifDlg
  526.  -
  527.  *  Purpose:
  528.  */
  529. /*********************************************************************/
  530.  
  531. // test defined
  532. #define MAPI_TABLE  ((ULONG) 0x0000000C)
  533.  
  534. class CNotifDlg : public CModalDialog
  535. {
  536. public:   
  537.     LPNOTIFS        *m_lppNotifs;
  538.     CString         m_Description;
  539.     LPUNKNOWN       m_lpUnk;
  540.     ULONG           m_ulObjType;
  541.     LPENTRYID       m_lpEntryID;
  542.     ULONG           m_cbEntryID;
  543.             
  544.     CNotifDlg(CWnd  *pParentWnd)
  545.         : CModalDialog(NOTIF, pParentWnd)
  546.     {
  547.         m_lppNotifs      = NULL;
  548.         m_lpUnk          = NULL;
  549.         m_ulObjType      = 0;
  550.         m_lpEntryID      = NULL;
  551.         m_cbEntryID      = 0;
  552.     }
  553.  
  554.     ~CNotifDlg();   
  555.  
  556.     BOOL OnInitDialog();
  557.     void OnCancel();    
  558.     void Display();
  559.  
  560.     void OnNewAdvise();
  561.     void OnUnadvise();
  562.  
  563.     DECLARE_MESSAGE_MAP();
  564.    
  565. };
  566.  
  567.  
  568. /*********************************************************************/
  569. /*
  570.  -  CAdviseNotifDlg
  571.  -
  572.  *  Purpose:
  573.  */
  574. /*********************************************************************/
  575. #ifdef XVPORT
  576.  
  577. class CAdviseNotifDlg : public CModalDialog
  578. {
  579. public:   
  580.     LPNOTIFS        *m_lppNotifs;
  581.     CString         m_Description;
  582.     LPUNKNOWN       m_lpUnk;
  583.     ULONG           m_ulObjType;
  584.     LPENTRYID       m_lpEntryID;
  585.     ULONG           m_cbEntryID;
  586.         
  587.     CAdviseNotifDlg(CWnd  *pParentWnd)
  588.         : CModalDialog(ADVISENOTIF, pParentWnd)
  589.     {
  590.         m_lppNotifs      = NULL;
  591.         m_lpUnk          = NULL;
  592.         m_ulObjType      = 0;
  593.         m_lpEntryID      = NULL;
  594.         m_cbEntryID      = 0;
  595.     }
  596.  
  597.     ~CAdviseNotifDlg(); 
  598.  
  599.     BOOL OnInitDialog();
  600.     void OnCancel();    
  601.     void OnOK();
  602.     
  603. };
  604.  
  605. #endif
  606.       
  607. #endif  // __mdbview_h_
  608.  
  609.