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

  1. /*******************************************************************/
  2. /*
  3.  -  msg.cpp
  4.  -  Copyright (C) 1995 Microsoft Corporation
  5.  -
  6.  *  Purpose:
  7.  *      Contains member functions for CMessageDlg
  8.  */
  9. /*******************************************************************/
  10.                                                    
  11. #undef  CINTERFACE      // C++ calling convention for mapi calls
  12.  
  13.  
  14. #define XVPORT
  15.  
  16. #ifdef WIN32
  17. #ifdef _WIN95
  18. #define _INC_OLE
  19. #endif
  20. #define INC_OLE2
  21. #define INC_RPC
  22. #endif
  23.  
  24. #include <afxwin.h>     
  25. #include <windowsx.h>
  26. #include <string.h>
  27.  
  28. #ifdef WIN16
  29. #include <compobj.h>
  30. #endif
  31.  
  32. #ifdef WIN32
  33. #include <objbase.h>
  34. #include <objerror.h>
  35. #ifdef _WIN95
  36. #include <ole2.h>
  37. #endif
  38. #endif
  39.  
  40. #include <mapix.h>      
  41. #ifdef WIN16
  42. #include <mapiwin.h>    
  43. #endif
  44. #include <strtbl.h>     
  45. #include <misctool.h>
  46. #include <pvalloc.h>
  47. #include "resource.h"   
  48. #include "mdbview.h" 
  49. #include "msg.h"
  50. #include "attach.h"
  51. #include "oper.h"
  52.  
  53. #include <string.h> // for _stricmp()
  54.  
  55. /***** Table viewer TBLVU functions ***********/
  56.  
  57. extern  HINSTANCE    hlibTBLVU;
  58.  
  59. typedef BOOL (*LPFNVIEWMAPITABLE)(
  60.     LPMAPITABLE FAR     *lppMAPITable,
  61.     HWND                hWnd);    
  62.  
  63. extern  LPFNVIEWMAPITABLE lpfnViewMapiTable;
  64. #define TBLVUViewMapiTable (*lpfnViewMapiTable)
  65.  
  66.  
  67. /***** Property viewer PROPVU functions *******/
  68.  
  69. extern HINSTANCE    hlibPROPVU;
  70.  
  71. typedef BOOL (*LPFNVIEWMAPIPROP)(
  72.     LPSTR           lpszName,
  73.     LPMAPIPROP FAR *lppMAPIProp,
  74.     LPVOID          lpvDest,
  75.     HWND            hWnd);    
  76.  
  77. extern LPFNVIEWMAPIPROP lpfnViewMapiProp;
  78. #define PROPVUViewMapiProp (*lpfnViewMapiProp)
  79.  
  80. /******************* global variables ***************************/
  81.  
  82. extern LPMAPISESSION        lpSession;
  83. extern LPMDB                lpMDB;
  84. extern LPADRBOOK            lpAdrBook;
  85. extern HRESULT              hResultSession;
  86. extern LPVOID               lpvCopyToDest;
  87. extern ULONG                ulAccess;
  88.  
  89.  
  90.  
  91. #ifdef XVPORT
  92. extern "C"
  93. {
  94. extern NOTIFCALLBACK LogNotifToXVPLog;
  95. }
  96.  
  97. #endif
  98. extern "C"
  99. {
  100. extern NOTIFCALLBACK RedrawRecipientTable;
  101. }
  102.  
  103. extern "C"
  104. {
  105. extern NOTIFCALLBACK RedrawAttachmentTable;
  106. }
  107.  
  108. /******************* Msg Message Map ****************************/
  109.  
  110. BEGIN_MESSAGE_MAP(CMessageDlg, CDialog)
  111.  
  112.     ON_LBN_DBLCLK(  IDC_PROPS,          OnPropInterface)
  113.     ON_LBN_DBLCLK(  IDC_MSGATTACH,      OnOpenAttachLB)
  114.     ON_LBN_DBLCLK(  IDC_MSGRECIPIENTS,  OnRecipTable)
  115.     ON_COMMAND(     IDC_CALLFUNC,       OnCallFunction)
  116.     ON_COMMAND(     IDC_PROPINTERFACE,  OnPropInterface)
  117.     ON_COMMAND(     IDC_MSG_X400_PROPS, OnX400Props)
  118.     ON_COMMAND(     IDC_SPECIALPROPS,   OnSpecialProps)
  119.                                         
  120. END_MESSAGE_MAP() 
  121.  
  122.  
  123.  
  124. /**************************** Message ******************************/
  125. /********************************************************************/
  126. /********************* Callbacks ************************************/
  127.  
  128. SCODE STDAPICALLTYPE RedrawRecipientTable(  LPVOID          lpvContext, 
  129.                                             ULONG           cNotif, 
  130.                                             LPNOTIFICATION  lpNotif)
  131. {
  132.     ((CMessageDlg *)(lpvContext))->DisplayRecips();
  133.     return(S_OK);
  134. }                             
  135.  
  136. /********************************************************************/
  137.  
  138. SCODE STDAPICALLTYPE RedrawAttachmentTable(  LPVOID          lpvContext, 
  139.                                             ULONG           cNotif, 
  140.                                             LPNOTIFICATION  lpNotif)
  141. {
  142.     ((CMessageDlg *)(lpvContext))->DisplayAttachments();
  143.     return(S_OK);
  144. }                             
  145.  
  146.  
  147.  
  148. /********************************************************************/
  149. /*
  150.  -  CMessageDlg::
  151.  -  OnNotifMsg
  152.  -
  153.  *  Purpose:
  154.  *  
  155.  /********************************************************************/
  156.  
  157. void CMessageDlg::OnNotifMsg()
  158. {       
  159.     CNotifDlg   Notif(this);
  160.     
  161.     Notif.m_Description = m_CurrentMessage;
  162.     Notif.m_lpUnk       = lpMDB;
  163.     Notif.m_ulObjType   = MAPI_STORE;    
  164.     Notif.m_lppNotifs   = &m_lpNotifMsg;
  165.     Notif.DoModal();
  166.     
  167. }
  168. /********************************************************************/
  169. /*
  170.  -  CMessageDlg::
  171.  -  OnNotifAttTbl
  172.  -
  173.  *  Purpose:
  174.  *  
  175.  /********************************************************************/
  176.  
  177. void CMessageDlg::OnNotifAttTbl()
  178. {       
  179.  
  180.     CNotifDlg   Notif(this);
  181.     
  182.     Notif.m_Description = "AttachmentTable Notification";
  183.     Notif.m_lpUnk       = m_lpAttachTable;
  184.     Notif.m_ulObjType   = MAPI_TABLE;
  185.     Notif.m_lppNotifs   = &m_lpNotifAttTbl;
  186.     Notif.DoModal();
  187. }
  188.  
  189.  
  190. /********************************************************************/
  191. /*
  192.  -  CMessageDlg::
  193.  -  OnNotifRecipTbl
  194.  -
  195.  *  Purpose:
  196.  *  
  197.  /********************************************************************/
  198.  
  199. void CMessageDlg::OnNotifRecipTbl()
  200. {       
  201.     CNotifDlg   Notif(this);
  202.     
  203.     Notif.m_Description = "RecipientTable Notification";
  204.     Notif.m_lpUnk       = m_lpRecipTable;
  205.     Notif.m_ulObjType   = MAPI_TABLE;
  206.     Notif.m_lppNotifs   = &m_lpNotifRecipTbl;
  207.     Notif.DoModal();
  208. }
  209.  
  210.  
  211. /*******************************************************************/
  212. /*
  213.  -  CMessageDlg::
  214.  -  OnX400Props
  215.  -
  216.  *  Purpose:
  217.  *      Closes the Message dialog.
  218.  *
  219.  */
  220. /*******************************************************************/
  221.  
  222. void CMessageDlg::OnX400Props()
  223. {
  224.     LPSPropValue    lpspva          = NULL;
  225.     ULONG           cValues         = 0;
  226.  
  227.     // switch based upon PR_MESSAGE_CLASS 
  228.     //   IPM.Note               (IPM message)
  229.     //   REPORT.IPM.Note.IPNRN  (IPN Receipt Notification)
  230.     //   REPORT.IPM.Note.IPNNRN (IPN Non Receipt Notification)
  231.     //   Other ???
  232.  
  233.     SizedSPropTagArray(1,sptaMsgClass) = 
  234.     {
  235.         1, 
  236.         { 
  237.             PR_MESSAGE_CLASS,
  238.         }
  239.     };
  240.     
  241.     m_hResult = m_lpMessage->GetProps( (LPSPropTagArray) &sptaMsgClass,0,&cValues, &lpspva);
  242.     if( HR_FAILED(m_hResult))        
  243.     {
  244.         MessageBox( m_E.SzError("CMessageDlg::OnX400Props()  m_lpMessage->GetProps(&sptaMsgClass)", m_hResult),
  245.                      "Client", MBS_ERROR );
  246.         return;
  247.     }
  248.     
  249.     if(lpspva[0].ulPropTag != PR_MESSAGE_CLASS )
  250.     {
  251.         MessageBox( "lpspva[0].ulPropTag != PR_MESSAGE_CLASS", "Client", MBS_ERROR );
  252.         return;
  253.     }
  254.     
  255.     if( !_stricmp(lpspva[0].Value.lpszA,"IPM.Note" ) )
  256.     {
  257.         CIPMSpecialDlg    MsgIPMX400(m_lpMessage,this);
  258.         MsgIPMX400.DoModal();
  259.     }        
  260.     else if( !_stricmp(lpspva[0].Value.lpszA,"REPORT.IPM.Note.IPNRN" ) )
  261.     {
  262.         CIPNSpecialDlg    MsgIPNRNX400(m_lpMessage,this);
  263.         MsgIPNRNX400.DoModal();
  264.     }        
  265.     else if( !_stricmp(lpspva[0].Value.lpszA,"REPORT.IPM.Note.IPNNRN" ) )
  266.     {
  267.         CIPNSpecialDlg    MsgIPNNRNX400(m_lpMessage,this);
  268.         MsgIPNNRNX400.DoModal();
  269.     }        
  270.     else // this is .DR and .NDR, and others
  271.     {
  272.         CIPMSpecialDlg    MsgDefaultX400(m_lpMessage,this);
  273.         MsgDefaultX400.DoModal();
  274.     }        
  275. }
  276.  
  277. /*******************************************************************/
  278. /*
  279.  -  CMessageDlg::
  280.  -  OnSpecialProps
  281.  -
  282.  *  Purpose:
  283.  *      Closes the Message dialog.
  284.  *
  285.  */
  286. /*******************************************************************/
  287.  
  288. void CMessageDlg::OnSpecialProps()
  289. {
  290.     CMsgSpecialDlg    MsgSpecial(m_lpMessage,this);
  291.     MsgSpecial.DoModal();
  292. }
  293.  
  294. /********************************************************************/
  295. /*
  296.  -  CMessageDlg::
  297.  -  OnPropInterface
  298.  -
  299.  *  Purpose:
  300.  *  
  301.  /********************************************************************/
  302.  
  303. void CMessageDlg::OnPropInterface()
  304. {       
  305.     char    szBuffer[80];
  306.     
  307.     
  308.     lstrcpy(szBuffer,m_CurrentMessage.GetBuffer(50));
  309.     lstrcat(szBuffer," Properties");
  310.  
  311.     PROPVUViewMapiProp(szBuffer, 
  312.                 (LPMAPIPROP FAR *)&m_lpEntry,lpvCopyToDest, (HWND)this->m_hWnd );
  313.                 
  314. }
  315.  
  316.  
  317. /********************************************************************/
  318. /*
  319.  -  CMessageDlg::
  320.  -  OnShowForm
  321.  -
  322.  *  Purpose:
  323.  *  
  324.                 LPSERVICEADMIN FAR *        lppServiceAdmin) IPURE;     \
  325.     MAPIMETHOD(ShowForm)                                                \
  326.         (THIS_  ULONG                       ulUIParam,                  \
  327.                 LPMDB                       lpMsgStore,                 \
  328.                 LPMAPIFOLDER                lpParentFolder,             \
  329.                 LPCIID                      lpInterface,                \
  330.                 ULONG                       ulMessageToken,             \
  331.                 LPMESSAGE                   lpMessageSent,              \
  332.                 ULONG                       ulFlags,                    \
  333.                 ULONG                       ulMessageStatus,            \
  334.                 ULONG                       ulMessageFlags,             \
  335.                 ULONG                       ulAccess,                   \
  336.                 LPSTR                       lpszMessageClass) IPURE;    \
  337.     MAPIMETHOD(PrepareForm)                                             \
  338.         (THIS_  LPCIID                      lpInterface,                \
  339.                 LPMESSAGE                   lpMessage,                  \
  340.                 ULONG FAR *                 lpulMessageToken) IPURE;    \
  341.  
  342.  
  343.  
  344.  /********************************************************************/
  345.  
  346. void CMessageDlg::OnShowForm()
  347. {   
  348.     COperation      MsgShowFormDlg(this);
  349.     CString         OperName;
  350.     LPMAPIFOLDER    lpParentFld         = NULL;
  351.     ULONG           ulFlags             = 0;
  352.     ULONG           ulMessageStatus     = 0;
  353.     LPSPropValue    lpspvaShow          = NULL;
  354.     ULONG           cValuesShow         = 0;
  355.     HRESULT         hResult1            = hrSuccess;
  356.     ULONG           ulObjType           = 0;
  357.     DWORD           dRet                = 0;
  358.     ULONG           ulMessageToken      = 0;
  359.     char            szAccess[80];
  360.     char            szMsgFlags[80];
  361.     char            szMsgStatus[512];
  362.     char            szMsgClass[80];
  363.  
  364.     szAccess[0]     = '\0';
  365.     szMsgFlags[0]   = '\0';
  366.     szMsgStatus[0]  = '\0';
  367.     szMsgClass[0]   = '\0';
  368.  
  369.     SizedSPropTagArray(5,sptaShowForm) = 
  370.     {
  371.         5, 
  372.         { 
  373.             PR_MESSAGE_FLAGS,
  374.             PR_MESSAGE_CLASS,
  375.             PR_ACCESS,
  376.             PR_PARENT_ENTRYID,
  377.             PR_ENTRYID,
  378.         }
  379.     };
  380.     
  381.     // GET REQUIRED PROPERTIES FROM MESSAGE    
  382.     m_hResult = m_lpMessage->GetProps( (LPSPropTagArray) &sptaShowForm,0,&cValuesShow, &lpspvaShow);
  383.     wsprintf(m_szLogBuf,"m_lpMessage->GetProps(&sptaShowForm,0, &cValuesShow, &lpspvaShow)\t SC: %s",
  384.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  385.  
  386.     if( HR_FAILED(m_hResult))        
  387.     {
  388.         MessageBox( m_E.SzError("CMessageDlg::OnShowForm()  m_lpMessage->GetProps(&sptaShowForm)", m_hResult),
  389.                      "Client", MBS_ERROR );
  390.         return;
  391.     }
  392.  
  393.     // OPEN UP PARENT FOLDER
  394.     if(lpspvaShow[3].ulPropTag != PR_PARENT_ENTRYID)
  395.     {
  396.         MessageBox("CMessageDlg::ShowForm  lpspvaShow[3].ulPropTag != PR_PARENT_ENTRYID",
  397.                         "Client", MBS_ERROR );
  398.         return;
  399.     }
  400.     hResult1 = lpMDB->OpenEntry(    (ULONG)     lpspvaShow[3].Value.bin.cb,
  401.                                     (LPENTRYID) lpspvaShow[3].Value.bin.lpb,
  402.                                     NULL,
  403.                                     ulAccess,
  404.                                     &ulObjType,
  405.                                     (LPUNKNOWN*)(LPMAPIPROP *) &lpParentFld);
  406.     if( HR_FAILED(hResult1) )
  407.     {
  408.         MessageBox( m_E.SzError("lpMDB->OpenEntry() Parent Folder",hResult1),
  409.                         "Client", MBS_ERROR );
  410.         return;
  411.     }
  412.     if( ulObjType != MAPI_FOLDER )
  413.     {
  414.         MessageBox("ulObjType of OpenEntry on lpFolder != MAPI_FOLDER","Client",MBS_ERROR);
  415.         return;
  416.     }
  417.         
  418.     // initalize data for dialog box
  419.     OperName  = "lpSession->ShowForm()";
  420.  
  421.     MsgShowFormDlg.m_CurrentOperation= OperName;
  422.  
  423.     MsgShowFormDlg.m_CBText1         = "ulUIParam";
  424.     MsgShowFormDlg.m_EditText1       = "lpszMessageClass:";
  425.     MsgShowFormDlg.m_EditText2       = "ulMessageStatus:";
  426.     MsgShowFormDlg.m_EditText3       = "ulMessageFlags:";
  427.     MsgShowFormDlg.m_CBText1         = "ulAccess:";
  428.  
  429.     MsgShowFormDlg.m_FlagText1       = "MAPI_POST_MESSAGE";
  430.     MsgShowFormDlg.m_FlagText2       = "MAPI_NEW_MESSAGE";
  431.     MsgShowFormDlg.m_FlagText3       = "Invalid Flag";
  432.  
  433.  
  434.     // PR_MESSAGE_FLAGS
  435.     if(lpspvaShow[0].ulPropTag != PR_MESSAGE_FLAGS)
  436.     {
  437.         MessageBox("CMessageDlg::ShowForm  lpspvaShow[0].ulPropTag != PR_MESSAGE_FLAGS",
  438.                         "Client", MBS_ERROR );
  439.         return;
  440.     }
  441.     wsprintf(szMsgFlags,"%lu", lpspvaShow[0].Value.ul);
  442.     MsgShowFormDlg.m_EditDefault3    = szMsgFlags;
  443.  
  444.  
  445.     // PR_MESSAGE_CLASS
  446.     if(lpspvaShow[1].ulPropTag != PR_MESSAGE_CLASS)
  447.     {
  448.         MessageBox("CMessageDlg::ShowForm  lpspvaShow[1].ulPropTag != PR_MESSAGE_CLASS",
  449.                         "Client", MBS_ERROR );
  450.         return;
  451.     }
  452.     wsprintf(szMsgClass,"%s",lpspvaShow[1].Value.lpszA);
  453.     MsgShowFormDlg.m_EditDefault1    = szMsgClass;
  454.  
  455.     // PR_ACCESS
  456.     if(lpspvaShow[2].ulPropTag != PR_ACCESS)
  457.     {
  458.         MessageBox("CMessageDlg::ShowForm  lpspvaShow[2].ulPropTag != PR_ACCESS",
  459.                         "Client", MBS_ERROR );
  460.         return;
  461.     }
  462.     wsprintf(szAccess,"%lu",lpspvaShow[2].Value.ul);
  463.     dRet = MsgShowFormDlg.m_CBContents1.Add(szAccess);
  464.  
  465.  
  466.  
  467.  
  468.     // PR_MSG_STATUS FROM lpFld->GetMsgStatus()
  469.     if(lpspvaShow[4].ulPropTag != PR_ENTRYID)
  470.     {
  471.         MessageBox("CMessageDlg::ShowForm  lpspvaShow[4].ulPropTag != PR_ENTRYID",
  472.                         "Client", MBS_ERROR );
  473.         return;
  474.     }
  475.  
  476.     m_hResult = lpParentFld->GetMessageStatus(
  477.                         (ULONG)     lpspvaShow[4].Value.bin.cb,
  478.                         (LPENTRYID) lpspvaShow[4].Value.bin.lpb,
  479.                         0,
  480.                         &ulMessageStatus  );
  481.     wsprintf(m_szLogBuf,"lpFolder->GetMessageStatus()\t SC: %s",
  482.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  483.  
  484.     if( HR_FAILED(m_hResult))
  485.     {
  486.         MessageBox( m_E.SzError("lpParentFld->GetMessageStatus()", m_hResult),
  487.                 "Client", MBS_ERROR );
  488.         return;
  489.     }
  490.  
  491.     wsprintf(szMsgStatus,"ulMsgStatus == %#04X, %s%s%s%s",ulMessageStatus,
  492.       ((ulMessageStatus & MSGSTATUS_HIGHLIGHTED)    ? "MSGSTATUS_HIGHLIGHTED | ": ""),
  493.       ((ulMessageStatus & MSGSTATUS_TAGGED)         ? "MSGSTATUS_TAGGED | "     : ""),
  494.       ((ulMessageStatus & MSGSTATUS_HIDDEN)         ? "MSGSTATUS_HIDDEN | "     : ""),
  495.       ((ulMessageStatus & MSGSTATUS_DELMARKED)      ? "MSGSTATUS_DELMARKED | "  : ""));
  496.  
  497.     MsgShowFormDlg.m_EditDefault2    = szMsgStatus;
  498.  
  499.     // first get props appropriate for this message off prop list
  500.  
  501.     // bring up modal dialog box, and if user hits OK, process operation
  502.     if( MsgShowFormDlg.DoModal() == IDOK )      
  503.     {       
  504.         // determine state/settings of data in dialog upon closing
  505.                 
  506.         if( MsgShowFormDlg.m_bFlag1 )                
  507.             ulFlags |= MAPI_POST_MESSAGE;
  508.  
  509.         if( MsgShowFormDlg.m_bFlag2 )                
  510.             ulFlags |= MAPI_NEW_MESSAGE;
  511.  
  512.         if( MsgShowFormDlg.m_bFlag3 )                
  513.             ulFlags |= TEST_INVALID_FLAG;
  514.  
  515.         hResultSession = lpSession->PrepareForm(NULL,m_lpMessage,&ulMessageToken);
  516.         wsprintf(m_szLogBuf,"lpSession->PrepareForm()\t SC: %s",
  517.                             GetString( "MAPIErrors", GetScode(hResultSession), m_szError ) );
  518.  
  519.         if( HR_FAILED(hResultSession))        
  520.         {
  521.             MessageBox( m_E.SzError("CMessageDlg::ShowForm()  lpSession->PrepareForm()", hResultSession),
  522.                          "Client", MBS_ERROR );
  523.  
  524.             m_lpMessage->Release();
  525.             m_lpMessage = NULL;
  526.             Cleanup();
  527.             OnCancel();
  528.  
  529.             return;
  530.         }
  531.  
  532.         m_lpMessage->Release();
  533.         m_lpMessage = NULL;
  534.  
  535.  
  536.         hResultSession = lpSession->ShowForm( 
  537.                             (ULONG) (void *) this->m_hWnd,
  538.                             (LPMDB)          lpMDB,
  539.                             (LPMAPIFOLDER)   lpParentFld,
  540.                             (LPIID)          NULL,
  541.                             (ULONG)          ulMessageToken,
  542.                             (LPMESSAGE)      NULL,
  543.                             (ULONG)          ulFlags,
  544.                             (ULONG)          ulMessageStatus,
  545.                             (ULONG)          lpspvaShow[0].Value.ul,
  546.                             (ULONG)          lpspvaShow[2].Value.ul,
  547.                             (LPSTR)          lpspvaShow[1].Value.lpszA);
  548.                             
  549.         wsprintf(m_szLogBuf,"lpSession->ShowForm()\t SC: %s",
  550.                             GetString( "MAPIErrors", GetScode(hResultSession), m_szError ) );
  551.  
  552.         if( HR_FAILED(hResultSession))        
  553.         {
  554.             MessageBox( m_E.SzError("CMessageDlg::ShowForm()  lpSession->ShowForm()", hResultSession),
  555.                          "Client", MBS_ERROR );
  556.         }
  557.     }
  558.  
  559.     m_lpMessage = NULL;
  560.     Cleanup();
  561.     OnCancel();
  562.  
  563. }
  564.  
  565. /********************************************************************/
  566. /*
  567.  -  CMessageDlg::
  568.  -  DisplayMsgFlags
  569.  -
  570.  *  Purpose:
  571.  *  
  572.  /********************************************************************/
  573.  
  574. void CMessageDlg::DisplayMsgFlags()
  575. {       
  576.     DWORD           dwReturn    = 0;
  577.     ULONG           ulValues    = 0;
  578.     LPSPropValue    lpPropValue = NULL;
  579.     ULONG           ulNum       = 0;
  580.     ULONG           idx;
  581.     ULONG           ulID        = 0;
  582.     char            szBuffer[80];
  583.     char            szFlags[80];
  584.  
  585.  
  586.     SizedSPropTagArray(1,sptaMsgFlags) = 
  587.     {
  588.         1, 
  589.         { 
  590.             PR_MESSAGE_FLAGS,
  591.         }
  592.     };
  593.  
  594.     dwReturn = SendDlgItemMessage(IDC_MSGFLAGS,LB_RESETCONTENT,0,0);
  595.  
  596.  
  597.     // get the msg flags from the message
  598.     m_hResult = m_lpMessage->GetProps( (LPSPropTagArray) &sptaMsgFlags,0,&ulValues, &lpPropValue);
  599.     wsprintf(m_szLogBuf,"m_lpMessage->GetProps(&sptaMsgFlags,0, &ulValues, &lpPropValue)\t SC: %s",
  600.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  601.  
  602.     if( HR_FAILED(m_hResult))        
  603.     {
  604.         MessageBox( m_E.SzError("CMessageDlg::DisplayMsgFlags()  m_lpMessage->GetProps(&sptaMsgFlags)", m_hResult),
  605.                      "Client", MBS_ERROR );
  606.         return;
  607.     }
  608.  
  609.     wsprintf(szFlags,"PR_MESSAGE_FLAGS == %lu",lpPropValue[0].Value.l);
  610.     SetDlgItemText(IDT_MSGFLAGS,szFlags);
  611.  
  612.     // for each flag in stringtable 
  613.     ulNum = GetRowCount("MsgFlags");     
  614.     for(idx = 0; idx < ulNum; idx++)
  615.     {     
  616.         ulID = GetRowID("MsgFlags",idx);
  617.         if( ulID & lpPropValue[0].Value.l)
  618.         {
  619.             GetRowString("MsgFlags",idx,szBuffer);            
  620.             SendDlgItemMessage(IDC_MSGFLAGS, LB_ADDSTRING, 0, (LPARAM)szBuffer);
  621.         }
  622.     }
  623.     
  624.     if(lpPropValue)
  625.     {
  626.         MAPIFreeBuffer(lpPropValue);
  627.         wsprintf(m_szLogBuf,"MAPIFreeBuffer(%s)", "lpPropValue from GetProps" );
  628.     }
  629. }
  630.  
  631.  
  632. /********************************************************************/
  633. /*
  634.  -  CMessageDlg::
  635.  -  OnRecipientOptions
  636.  -
  637.  *  Purpose:
  638.  *  
  639.  /********************************************************************/
  640.  
  641. void CMessageDlg::OnRecipientOptions()
  642. {       
  643.     LONG        lCurSelect  = 0;
  644.     LONG        lRowsSeeked = 0;
  645.     LPSRowSet   lpRows      = NULL;
  646.     HRESULT     hResult1    = hrSuccess;
  647.     LPADRENTRY  lpAdrEntry  = NULL;
  648.  
  649.     LPADRLIST       lpAdrList       = NULL;
  650.     CAdrListDlg     AdrList1(this);
  651.     CAdrListDlg     AdrList2(this);
  652.  
  653.     
  654.     // get selected item from child folder listbox
  655.     if( (lCurSelect = SendDlgItemMessage(IDC_MSGRECIPIENTS,LB_GETCURSEL,0,0 )) < 0 )
  656.     {
  657.         MessageBox("Select a Recipient to see Options", "OnRecipintOptions", MBS_ERROR );
  658.         return;
  659.     }
  660.     
  661.     m_hResult = m_lpRecipTable->SeekRow( BOOKMARK_BEGINNING,lCurSelect,&lRowsSeeked);
  662.  
  663.     wsprintf(m_szLogBuf,"lpRecipTable->SeekRow( BOOKMARK_BEGINNING,%ld,&lRowsSeeked)\t SC: %s",
  664.                         lCurSelect,
  665.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  666.  
  667.     if( HR_FAILED(m_hResult))    
  668.     {
  669.         MessageBox( m_E.SzError("m_lpRecipTable->SeekRow", m_hResult), 
  670.                             "Client", MBS_ERROR );
  671.         goto Error;
  672.     }
  673.  
  674.     m_hResult = m_lpRecipTable->QueryRows( 1, 0, &lpRows );
  675.  
  676.     wsprintf(m_szLogBuf,"lpRecipTable->QueryRows( 1, 0, &lpRows )\t SC: %s",
  677.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  678.  
  679.     if( HR_FAILED(m_hResult))    
  680.  
  681.     {
  682.         MessageBox( m_E.SzError("m_lpRecipTable->QueryRows", m_hResult), 
  683.                             "Client", MBS_ERROR );
  684.         goto Error;
  685.     }
  686.  
  687.     // we can caste a LPRowSet to a LPADRLIST
  688.     lpAdrList = (LPADRLIST) lpRows;
  689.  
  690.     // display address list before
  691.     AdrList1.m_List       = "Address List of Recipient BEFORE RecipOptions";
  692.     AdrList1.m_lpAdrList  = lpAdrList;
  693.     AdrList1.DoModal();
  694.  
  695.     // a row of the recipient table is the same structure as a LPADRENTRY
  696.     
  697.     lpAdrEntry = (LPADRENTRY) &(lpRows->aRow[0]);
  698.                  
  699.     // in order to get anythign back from MAPI my lpAdrEntry must have a 
  700.     // PR_ENTRYID
  701.     // PR_DISPLAY_NAME
  702.     // PR_ADRTYPE                    
  703.                  
  704.     hResult1 = lpAdrBook->RecipOptions(NULL,0,(LPADRENTRY)  lpAdrEntry );
  705.     
  706.     wsprintf(m_szLogBuf,"lpAdrBook->RecipientOptions(NULL,0,(LPADRENTRY) lpAdrEntry)\t SC: %s",
  707.                         GetString( "MAPIErrors", GetScode(hResult1), m_szError ) );
  708.  
  709.     if( HR_FAILED(hResult1))    
  710.  
  711.     {
  712.         MessageBox( m_E.SzError("lpAdrBook->RecipientOptions", hResult1), 
  713.                             "Client", MBS_ERROR );
  714.         goto Error;
  715.     }
  716.  
  717.     // display address list before
  718.     AdrList1.m_List       = "Address List of Recipient AFTER RecipOptions";
  719.     AdrList1.m_lpAdrList->aEntries[0].cValues       = lpAdrEntry[0].cValues;
  720.     AdrList1.m_lpAdrList->aEntries[0].rgPropVals    = lpAdrEntry[0].rgPropVals;
  721.     AdrList1.m_lpAdrList->aEntries[0].ulReserved1   = lpAdrEntry[0].ulReserved1;
  722.     AdrList1.m_lpAdrList->cEntries                  = 1;
  723.     AdrList1.DoModal();
  724.  
  725.  
  726. Error:
  727.  
  728.     hResult1 = hrSuccess;
  729.  
  730. }
  731.  
  732.  
  733.  
  734. /*******************************************************************/
  735. /*
  736.  -  CMessageDlg::
  737.  -  OnSetCopyToDest
  738.  *
  739.  *  Purpose:
  740.  *      Set Destination object of CopyTo operation or CopyMessage or CopyFolder
  741.  *
  742.  *  lpvCopyToDest and CopyToDest are global
  743.  */
  744. /*******************************************************************/
  745.  
  746. void CMessageDlg::OnSetCopyToDest()
  747. {                
  748.     char       szBuffer[256];
  749.     
  750.     lpvCopyToDest   = (LPVOID) m_lpMessage;       
  751.     
  752.     wsprintf(szBuffer,"%s is next Destination for CopyTo(), CopyMessage(), or CopyFolder()",
  753.                 m_CurrentMessage.GetBuffer(40) );
  754.  
  755.     MessageBox( szBuffer,"Client", MBS_INFO );
  756. }    
  757.  
  758. /********************************************************************/
  759. /*
  760.  -  CMessageDlg::
  761.  -  OnMDBProp
  762.  -
  763.  *  Purpose:
  764.  *  
  765.  /********************************************************************/
  766.  
  767. void CMessageDlg::OnMDBProp()
  768. {   
  769.     PROPVUViewMapiProp("MDB Properties", 
  770.             (LPMAPIPROP FAR *)&lpMDB,lpvCopyToDest, (HWND)this->m_hWnd );
  771. }
  772.  
  773. /********************************************************************/
  774. /*
  775.  -  CMessageDlg::
  776.  -  InitMsgDialog
  777.  -
  778.  *  Purpose:  
  779.  *      Initialize the dialog after it was created in the PropDlg class
  780.  *      This routine is called in the constructor in lei of OnInitDialog()
  781.  *      so that it can fill in all of the appropriate listboxes, etc in
  782.  *      the dialog.  We can't use the OnInitDialog because the OnInitDialog
  783.  *      in the PropDialog Class and MFC doesn't explicitly call it for
  784.  *      this inherited class as well.
  785.  */
  786. /********************************************************************/
  787.  
  788. BOOL CMessageDlg::InitMsgDialog()
  789. {
  790.     DWORD           dwReturn        = 0;
  791.     LPSPropValue    lpspvaEID       = NULL;
  792.     ULONG           ulValuesEID     = 0;
  793.     LPSPropTagArray lpsptaAll       = NULL;
  794.     DWORD           dwIndex         = 0;
  795.  
  796.     // PropTag Array for getting only attachment number USED IN SETCOLUMNS
  797.     SizedSPropTagArray(1,sptaAttachNum) = 
  798.     {
  799.         1, 
  800.         { 
  801.             PR_ATTACH_NUM,
  802.         }
  803.     };
  804.  
  805.     
  806.     SizedSPropTagArray(1,sptaEID) = 
  807.     {
  808.         1, 
  809.         { 
  810.             PR_ENTRYID,
  811.         }
  812.     };
  813.  
  814.     SetWindowText( m_CurrentMessage.GetBuffer(15) );
  815.         
  816.     // disable the system menu close item
  817.     //  this is done because there is a MFC 2.0 bug that
  818.     //  makes you capture several PostNcDestroy messages etc.
  819.     GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, MF_GRAYED);
  820.  
  821.      
  822.     m_hResult = m_lpMessage->GetProps( (LPSPropTagArray) &sptaEID,0, &ulValuesEID, &lpspvaEID);
  823.     wsprintf(m_szLogBuf,"lpMessage->GetProps( &sptaEID,0, &ulValues, &lpspva)\t SC: %s",
  824.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  825.  
  826.     if( HR_FAILED(m_hResult))        
  827.     {
  828.         MessageBox( m_E.SzError("lpMessage->GetProps(&sptaEID)",m_hResult),
  829.                      "Client", MBS_ERROR );
  830.         goto Setup;                             
  831.     }
  832.  
  833.     // notif window 
  834.     wsprintf(m_szMsgContextCritical,"fnevCriticalError, lpMessage %s, lpMDB",
  835.                     m_CurrentMessage.GetBuffer(15));
  836.  
  837. #ifdef XVPORT
  838.     AdviseObj(  lpMDB, 
  839.                 MAPI_STORE, 
  840.                 LogNotifToXVPLog,
  841.                 fnevCriticalError,
  842.                 (ULONG)     lpspvaEID[0].Value.bin.cb,
  843.                 (LPENTRYID) lpspvaEID[0].Value.bin.lpb,
  844.                 m_szMsgContextCritical,
  845.                 NULL,
  846.                 &m_lpNotifMsg);
  847.  
  848.     wsprintf(m_szMsgContextCreated,"fnevObjectCreated, lpMessage %s, lpMDB",
  849.                     m_CurrentMessage.GetBuffer(15));
  850.  
  851.     AdviseObj(  lpMDB, 
  852.                 MAPI_STORE, 
  853.                 LogNotifToXVPLog,
  854.                 fnevObjectCreated,
  855.                 (ULONG)     lpspvaEID[0].Value.bin.cb,
  856.                 (LPENTRYID) lpspvaEID[0].Value.bin.lpb,
  857.                 m_szMsgContextCreated,
  858.                 NULL,
  859.                 &m_lpNotifMsg);
  860.  
  861.     wsprintf(m_szMsgContextDeleted,"fnevObjectDeleted, lpMessage %s, lpMDB",
  862.                     m_CurrentMessage.GetBuffer(15));
  863.  
  864.     AdviseObj(  lpMDB, 
  865.                 MAPI_STORE, 
  866.                 LogNotifToXVPLog,
  867.                 fnevObjectDeleted,
  868.                 (ULONG)     lpspvaEID[0].Value.bin.cb,
  869.                 (LPENTRYID) lpspvaEID[0].Value.bin.lpb,
  870.                 m_szMsgContextDeleted,
  871.                 NULL,
  872.                 &m_lpNotifMsg);
  873.  
  874.     wsprintf(m_szMsgContextModified,"fnevObjectModified, lpMessage %s, lpMDB",
  875.                     m_CurrentMessage.GetBuffer(15));
  876.  
  877.     AdviseObj(  lpMDB, 
  878.                 MAPI_STORE, 
  879.                 LogNotifToXVPLog,
  880.                 fnevObjectModified,
  881.                 (ULONG)     lpspvaEID[0].Value.bin.cb,
  882.                 (LPENTRYID) lpspvaEID[0].Value.bin.lpb,
  883.                 m_szMsgContextModified,
  884.                 NULL,
  885.                 &m_lpNotifMsg);
  886.  
  887.     wsprintf(m_szMsgContextMoved,"fnevObjectMoved, lpMessage %s, lpMDB",
  888.                     m_CurrentMessage.GetBuffer(15));
  889.  
  890.     AdviseObj(  lpMDB, 
  891.                 MAPI_STORE, 
  892.                 LogNotifToXVPLog,
  893.                 fnevObjectMoved,
  894.                 (ULONG)     lpspvaEID[0].Value.bin.cb,
  895.                 (LPENTRYID) lpspvaEID[0].Value.bin.lpb,
  896.                 m_szMsgContextMoved,
  897.                 NULL,
  898.                 &m_lpNotifMsg);
  899.  
  900.     wsprintf(m_szMsgContextCopied,"fnevObjectCopied, lpMessage %s, lpMDB",
  901.                     m_CurrentMessage.GetBuffer(15));
  902.  
  903.     AdviseObj(  lpMDB, 
  904.                 MAPI_STORE, 
  905.                 LogNotifToXVPLog,
  906.                 fnevObjectCopied,
  907.                 (ULONG)     lpspvaEID[0].Value.bin.cb,
  908.                 (LPENTRYID) lpspvaEID[0].Value.bin.lpb,
  909.                 m_szMsgContextCopied,
  910.                 NULL,
  911.                 &m_lpNotifMsg);
  912.  
  913. #endif
  914.  
  915.     if(lpspvaEID)
  916.         MAPIFreeBuffer(lpspvaEID);                
  917.  
  918.  
  919.     // ATTACHMENT TABLE
  920.     // get list of attachments in table
  921.     m_hResult = m_lpMessage->GetAttachmentTable( 0 , &m_lpAttachTable );
  922.  
  923.     wsprintf(m_szLogBuf,"lpMessage->GetAttachmentTable(0, &m_lpAttachTable)\t SC: %s",
  924.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  925.  
  926.     if( HR_FAILED(m_hResult))    
  927.     {
  928.         MessageBox( m_E.SzError("m_lpMessage->GetAttachmentTable", m_hResult), 
  929.                             "Client", MBS_ERROR );
  930.         goto Recipients;
  931.     }
  932.     
  933.         
  934.     // redraw routine
  935.     AdviseObj(  m_lpAttachTable,
  936.                 MAPI_TABLE, 
  937.                 RedrawAttachmentTable,
  938.                 fnevTableModified, 
  939.                 0,
  940.                 NULL,
  941.                 "Msg AttachTable Redraw",
  942.                 this, 
  943.                 &m_lpNotifAttTbl);       
  944.  
  945.     // notif window 
  946.     wsprintf(m_szAttContext,"fnevTableModified, AttachmentTable of Message %s, lpTable",
  947.                             m_CurrentMessage.GetBuffer(15));
  948.  
  949.  
  950. #ifdef XVPORT
  951.  
  952.     AdviseObj(  m_lpAttachTable,
  953.                 MAPI_TABLE, 
  954.                 LogNotifToXVPLog,
  955.                 fnevTableModified, 
  956.                 0,
  957.                 NULL,
  958.                 m_szAttContext, 
  959.                 NULL,
  960.                 &m_lpNotifAttTbl);       
  961.  
  962. #endif
  963.     m_hResult = m_lpAttachTable->SetColumns( (LPSPropTagArray) &sptaAttachNum,0);
  964.  
  965.     wsprintf(m_szLogBuf,"lpAttachTable->SetColumns( &sptaAttachNum,0)\t SC: %s",
  966.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  967.  
  968.     if( HR_FAILED(m_hResult))    
  969.     {
  970.         MessageBox( m_E.SzError("m_lpAttachTable->SetColumns", m_hResult), 
  971.                             "Client", MBS_ERROR );
  972.     }
  973.  
  974.     DisplayAttachments();
  975.  
  976.  
  977. Recipients:
  978.  
  979.     // RECIPIENT TABLE
  980.  
  981.     // get all recipients of table and load reicips and recipient columns
  982.     m_hResult = m_lpMessage->GetRecipientTable( 0, &m_lpRecipTable );
  983.     wsprintf(m_szLogBuf,"m_lpMessage->GetRecipientTable( 0, &m_lpRecipTable )\t SC: %s",
  984.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  985.  
  986.     if( HR_FAILED(m_hResult))    
  987.     {
  988.         MessageBox( m_E.SzError("m_lpMessage->GetRecipientTable", m_hResult), 
  989.                             "Client", MBS_ERROR );
  990.         goto Setup;
  991.     }
  992.  
  993.  
  994.     // redraw routine
  995.     AdviseObj(  m_lpRecipTable,
  996.                 MAPI_TABLE, 
  997.                 RedrawRecipientTable,
  998.                 fnevTableModified, 
  999.                 0,
  1000.                 NULL,
  1001.                 "Msg Recipient Table Redraw",
  1002.                 this, 
  1003.                 &m_lpNotifRecipTbl);       
  1004.  
  1005.     // notif window 
  1006.     wsprintf(m_szRecipContext,"fnevTableModified, RecipientTable of Message %s, lpTable",
  1007.                             m_CurrentMessage.GetBuffer(15));
  1008.  
  1009. #ifdef XVPORT
  1010.  
  1011.     AdviseObj(  m_lpRecipTable,
  1012.                 MAPI_TABLE, 
  1013.                 LogNotifToXVPLog,
  1014.                 fnevTableModified, 
  1015.                 0,
  1016.                 NULL,
  1017.                 m_szRecipContext, 
  1018.                 NULL,
  1019.                 &m_lpNotifRecipTbl);       
  1020.  
  1021. #endif
  1022.  
  1023.     m_hResult = m_lpRecipTable->QueryColumns(TBL_ALL_COLUMNS, &lpsptaAll);
  1024.     wsprintf(m_szLogBuf,"lpRecipTable->QueryColumns(TBL_ALL_COLUMNS, &lpsptaAll)\t SC: %s",
  1025.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1026.  
  1027.     if( HR_FAILED(m_hResult))    
  1028.     {
  1029.         MessageBox( m_E.SzError("m_lpRecipTable->QueryColumns", m_hResult), 
  1030.                             "Client", MBS_ERROR );
  1031.         goto Setup;
  1032.     }
  1033.     
  1034.     // set columns all columns
  1035.     m_hResult = m_lpRecipTable->SetColumns( (LPSPropTagArray) lpsptaAll, 0);
  1036.     wsprintf(m_szLogBuf,"lpRecipTable->SetColumns( &sptaAll, 0)\t SC: %s",
  1037.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1038.  
  1039.     if( HR_FAILED(m_hResult))    
  1040.     {
  1041.         MessageBox( m_E.SzError("m_lpRecipTable->SetColumns", m_hResult), 
  1042.                             "Client", MBS_ERROR );
  1043.         goto Setup;
  1044.     }
  1045.     
  1046.     if(lpsptaAll)
  1047.         MAPIFreeBuffer(lpsptaAll);
  1048.  
  1049.     DisplayRecips();
  1050.  
  1051. Setup:
  1052.  
  1053.     ResetPropButtons();
  1054.     RedrawPropTable();
  1055.  
  1056.     // no listboxs currently selected
  1057.     dwReturn = SendDlgItemMessage(IDC_MSGRECIPIENTS,LB_SETCURSEL,(WPARAM)-1,0);
  1058.     dwReturn = SendDlgItemMessage(IDC_PROPS,        LB_SETCURSEL,(WPARAM)-1,0);
  1059.     dwReturn = SendDlgItemMessage(IDC_MSGATTACH,    LB_SETCURSEL,(WPARAM)-1,0);
  1060.  
  1061.     //***** Add Strings to call function combo box *****
  1062.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1063.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "Message Properties" );
  1064.  
  1065.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1066.     {
  1067.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1068.         return FALSE;
  1069.     }            
  1070.  
  1071.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1072.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->GetAttachmentTable()" );
  1073.  
  1074.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1075.     {
  1076.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1077.         return FALSE;
  1078.     }            
  1079.  
  1080.  
  1081.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1082.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->GetRecipientTable()" );
  1083.  
  1084.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1085.     {
  1086.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1087.         return FALSE;
  1088.     }            
  1089.  
  1090.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1091.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->OpenAttach()                       (ON SELECTED ATTACH)" );
  1092.  
  1093.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1094.     {
  1095.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1096.         return FALSE;
  1097.     }            
  1098.                      
  1099.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1100.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->ModifyRecipients()" );
  1101.  
  1102.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1103.     {
  1104.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1105.         return FALSE;
  1106.     }            
  1107.     
  1108.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1109.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->DeleteAttach()                     (ON SELECTED ATTACH)" );
  1110.  
  1111.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1112.     {
  1113.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1114.         return FALSE;
  1115.     }            
  1116.     
  1117.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1118.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->CreateAttach()" );
  1119.  
  1120.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1121.     {
  1122.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1123.         return FALSE;
  1124.     }            
  1125.  
  1126.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1127.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->SubmitMessage()" );
  1128.  
  1129.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1130.     {
  1131.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1132.         return FALSE;
  1133.     }            
  1134.  
  1135.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1136.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->SetReadFlag()" );
  1137.  
  1138.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1139.     {
  1140.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1141.         return FALSE;
  1142.     }            
  1143.  
  1144.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1145.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "Message Store Properties" );
  1146.  
  1147.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1148.     {
  1149.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1150.         return FALSE;
  1151.     }            
  1152.        
  1153.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1154.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpAdrBook->RecipientOptions               (ON SELECTED RECIPIENT)" );
  1155.  
  1156.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1157.     {
  1158.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1159.         return FALSE;
  1160.     }            
  1161.        
  1162.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1163.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpSession->MessageOptions()               (ON SELECTED MSG)" );
  1164.  
  1165.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1166.     {
  1167.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1168.         return FALSE;
  1169.     }            
  1170.  
  1171.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1172.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpSession->ShowForm()" );
  1173.  
  1174.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1175.     {
  1176.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1177.         return FALSE;
  1178.     }            
  1179.  
  1180.  
  1181.  
  1182.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1183.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpMsg->Adivse() / UnAdvise                (NOTIFICATIONS)" );
  1184.  
  1185.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1186.     {
  1187.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1188.         return FALSE;
  1189.     }            
  1190.  
  1191.  
  1192.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1193.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpAttachTbl->Adivse() / UnAdvise          (NOTIFICATIONS)" );
  1194.  
  1195.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1196.     {
  1197.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1198.         return FALSE;
  1199.     }            
  1200.  
  1201.  
  1202.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1203.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "lpRecipTbl->Adivse() / UnAdvise           (NOTIFICATIONS)" );
  1204.  
  1205.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1206.     {
  1207.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1208.         return FALSE;
  1209.     }            
  1210.  
  1211.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_ADDSTRING,
  1212.                                 (WPARAM) 0 , (LPARAM) (LPCTSTR) "INTERNAL -- SET THIS FOLDER AS COPY DESTINATION" );
  1213.  
  1214.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1215.     {
  1216.         MessageBox( "CB_ADDSTRING functions returned Error", "Client", MBS_ERROR );
  1217.         return FALSE;
  1218.     }            
  1219.  
  1220.     // SET CURRENT SELECTION IN COMBO BOX TO 1ST ITEM
  1221.     dwIndex = SendDlgItemMessage(IDC_FUNCTIONS, CB_SETCURSEL,
  1222.                                 (WPARAM) 0 , (LPARAM) 0 );
  1223.  
  1224.     if( (dwIndex == CB_ERR ) || (dwIndex == CB_ERRSPACE) )
  1225.     {
  1226.         MessageBox( "CB_SETCURSEL functions returned Error", "Client", MBS_ERROR );
  1227.         return FALSE;
  1228.     }            
  1229.  
  1230.     return TRUE;
  1231. }
  1232.  
  1233.  
  1234. /********************************************************************/
  1235. /*
  1236.  -  CMessageDlg::
  1237.  -  OnCallFunction
  1238.  -
  1239.  *  Purpose:
  1240.  *
  1241.  /********************************************************************/
  1242.  
  1243. void CMessageDlg::OnCallFunction()
  1244. {
  1245.     LONG    lCurSelect = CB_ERR;
  1246.     
  1247.     // get the selection from the Drop Down Listbox combo box
  1248.     // and switch to appropriate function selected based upon 
  1249.     // position in the combo box. (NOTE position is determined by
  1250.     // initialization from OnInitFld  order of adding to combobox
  1251.     
  1252.     // GetCurrentSelection Position
  1253.     lCurSelect = SendDlgItemMessage(IDC_FUNCTIONS,CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0 );
  1254.     if(lCurSelect == CB_ERR)
  1255.     {
  1256.         // no item was selected, bring up dialog to tell them to select something
  1257.         MessageBox( "Please Select a function in the adjacent drop down listbox to call",
  1258.                 "Client", MBS_OOPS );
  1259.         return;
  1260.    
  1261.     }
  1262.     // else it is a valid index in combo box
  1263.  
  1264.     // Switch to appropriate function
  1265.     switch(lCurSelect)
  1266.     {
  1267.         // MESSAGE FUNCTIONS
  1268.         case 0:        
  1269.             OnPropInterface();       
  1270.             break;
  1271.         case 1:
  1272.             OnAttachTable();         
  1273.             break;
  1274.         case 2:
  1275.             OnRecipTable();          
  1276.             break;
  1277.         case 3:
  1278.             OnOpenAttachLB();        
  1279.             break;
  1280.         case 4:
  1281.             OnModifyRecipients();    
  1282.             break;
  1283.         case 5:
  1284.             OnDeleteAttach();        
  1285.             break;
  1286.         case 6:
  1287.             OnCreateAttach();        
  1288.             break;
  1289.         case 7:
  1290.             OnSubmitMessage();       
  1291.             break;
  1292.         case 8:
  1293.             OnSetReadFlag();         
  1294.             break;
  1295.         case 9:
  1296.             OnMDBProp();             
  1297.             break;
  1298.         case 10:
  1299.             OnRecipientOptions();    
  1300.             break;
  1301.         case 11:    
  1302.             OnMessageOptions();      
  1303.             break;
  1304.         case 12:
  1305.             OnShowForm();
  1306.             break;  
  1307.         case 13:
  1308.             OnNotifMsg();
  1309.             break;
  1310.         case 14:
  1311.             OnNotifAttTbl();
  1312.             break;
  1313.         case 15:
  1314.             OnNotifRecipTbl();       
  1315.             break;
  1316.         case 16:
  1317.             OnSetCopyToDest();      
  1318.             break;
  1319.  
  1320.         default:
  1321.             MessageBox( "CMessageDlg::OnCallFunction() default ",
  1322.                 "Client", MBS_OOPS );
  1323.             break;       
  1324.     }    
  1325.  
  1326. }
  1327.  
  1328. /*******************************************************************/
  1329. /*
  1330.  -  CMessageDlg::
  1331.  -  RedrawPriority
  1332.  *
  1333.  *  Purpose:
  1334.  */
  1335. /*******************************************************************/
  1336.  
  1337. void CMessageDlg::RedrawPriority()
  1338. {
  1339.     LPSPropValue    lpspvaPriority  = NULL;
  1340.     ULONG           ulValues        = 0;
  1341.     DWORD           dwReturn        = 0;
  1342.  
  1343.     // PropTag Array for getting displayname and entryid
  1344.     SizedSPropTagArray(1,sptaPriority) = 
  1345.     {
  1346.         1, 
  1347.         { 
  1348.             PR_PRIORITY,
  1349.         }
  1350.     };
  1351.  
  1352.     m_hResult = m_lpMessage->GetProps( (LPSPropTagArray) &sptaPriority,0, &ulValues, &lpspvaPriority);
  1353.     wsprintf(m_szLogBuf,"lpMessage->GetProps( &sptaPriority,0, &ulValues, &lpspvaPriority)\t SC: %s",
  1354.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1355.  
  1356.     if( HR_FAILED(m_hResult))        
  1357.     {
  1358.         MessageBox( m_E.SzError("lpMessage->GetProps(&sptaPriority)",m_hResult),
  1359.                      "Client", MBS_ERROR );
  1360.     }
  1361.     
  1362.     if(lpspvaPriority[0].ulPropTag == PR_PRIORITY)
  1363.     {
  1364.         dwReturn = SendDlgItemMessage(IDC_MSGPRIORITY,LB_ADDSTRING,0,
  1365.                     (LPARAM) GetString("Priority",lpspvaPriority[0].Value.l,NULL) );
  1366.     }
  1367.     else
  1368.         dwReturn = SendDlgItemMessage(IDC_MSGPRIORITY,LB_ADDSTRING,0,
  1369.                     (LPARAM) (char *) "No Priority Set" );
  1370.  
  1371. }
  1372. /*******************************************************************/
  1373. /*
  1374.  -  CMessageDlg::
  1375.  -  OnMessageOptions
  1376.  *
  1377.  *  Purpose:
  1378.  */
  1379. /*******************************************************************/
  1380.  
  1381. void CMessageDlg::OnMessageOptions()
  1382. {
  1383.     COperation      MsgOptsDlg(this);
  1384.     ULONG           ulFlags         = 0;
  1385.     ULONG           cValues         = 0;
  1386.     LPSPropValue    lpspvaDefault   = NULL;
  1387.     LPWSTR          lpNewBuffer1    = NULL;
  1388.     DWORD           dRet            = 0;
  1389.     char            szBuff[80];
  1390.     ULONG           ulUIParam       = 0;
  1391.  
  1392.     MsgOptsDlg.m_CurrentOperation= "lpSession->MessageOptions()";
  1393.     MsgOptsDlg.m_CBText1         = "ulUIParam";
  1394.     MsgOptsDlg.m_EditText1       = "lpszAdrType:";
  1395.     MsgOptsDlg.m_FlagText1       = "MAPI_UNICODE";
  1396.     MsgOptsDlg.m_FlagText2       = "Invalid Flag";
  1397.  
  1398.     MsgOptsDlg.m_EditDefault1    = "MSPEER";
  1399.       
  1400.     dRet = MsgOptsDlg.m_CBContents1.Add("NULL");
  1401.     wsprintf(szBuff,"Parent hWnd == %X",this->m_hWnd);
  1402.     dRet = MsgOptsDlg.m_CBContents1.Add(szBuff);
  1403.  
  1404.     if( MsgOptsDlg.DoModal() == IDOK )      
  1405.     {             
  1406.         if( !lstrcmp(MsgOptsDlg.m_szCB1,"NULL") )
  1407.             ulUIParam = (ULONG)NULL;
  1408.         else
  1409.             ulUIParam = (ULONG)(void *)this->m_hWnd;                    
  1410.       
  1411.         // determine state/settings of data in dialog upon closing
  1412.         if( MsgOptsDlg.m_bFlag2 )                
  1413.             ulFlags |= TEST_INVALID_FLAG;
  1414.                 
  1415.         if( MsgOptsDlg.m_bFlag1 )                
  1416.         {
  1417.             ulFlags |= MAPI_UNICODE;
  1418.  
  1419.             String8ToUnicode(MsgOptsDlg.m_szEdit1, &lpNewBuffer1, NULL);
  1420.  
  1421.             hResultSession = lpSession->MessageOptions(
  1422.                                 ulUIParam,
  1423.                                 ulFlags,
  1424.                                 (LPTSTR) lpNewBuffer1,
  1425.                                 m_lpMessage);
  1426.  
  1427.             wsprintf(m_szLogBuf,"lpSession->MessageOptions(%lu,%lu,%s,&lpMsg)\t SC: %s",
  1428.                         ulUIParam,ulFlags,MsgOptsDlg.m_szEdit1,
  1429.                         GetString( "MAPIErrors", GetScode(hResultSession), m_szError ) );
  1430.                             
  1431.             if( HR_FAILED(hResultSession) )
  1432.             {
  1433.                 MessageBox( m_E.SzError("lpSession->MessageOptions()",
  1434.                              hResultSession),"Client", MBS_ERROR );
  1435.                 PvFree(lpNewBuffer1);
  1436.                 goto Error;
  1437.             }        
  1438.         
  1439.             PvFree(lpNewBuffer1);
  1440.         }
  1441.         else
  1442.         {
  1443.  
  1444.             hResultSession = lpSession->MessageOptions(
  1445.                                 ulUIParam,
  1446.                                 ulFlags,
  1447.                                 (LPTSTR) MsgOptsDlg.m_szEdit1,
  1448.                                 m_lpMessage);
  1449.  
  1450.             wsprintf(m_szLogBuf,"lpSession->MessageOptions(%lu,%lu,%s,&lpMsg)\t SC: %s",
  1451.                         ulUIParam,ulFlags,MsgOptsDlg.m_szEdit1,
  1452.                         GetString( "MAPIErrors", GetScode(hResultSession), m_szError ) );
  1453.  
  1454.             if( HR_FAILED(hResultSession) )                            
  1455.             {
  1456.                 MessageBox( m_E.SzError("lpSession->MessageOptions()",
  1457.                          hResultSession),"Client", MBS_ERROR );
  1458.                 goto Error;
  1459.             }        
  1460.         }
  1461.     }
  1462. Error:
  1463.  
  1464.     return;
  1465. }
  1466.  
  1467.  
  1468.  
  1469. /*******************************************************************/
  1470. /*
  1471.  -  CMesageDlg::
  1472.  -  OnModifyRecipients
  1473.  *
  1474.  *  Purpose:
  1475.  *      Operation lpMessage->ModifyRecipients
  1476.  */
  1477. /*******************************************************************/
  1478.  
  1479. void CMessageDlg::OnModifyRecipients()
  1480. {   
  1481.     COperation      MsgModifyAttachDlg(this);
  1482.     CString         OperName;
  1483.     int             dRet            = 0;
  1484.     ULONG           ulFlags         = 0;
  1485.     LPSTR           rglpszDestTitles[3];
  1486.     ULONG           rgulDestComps[3];
  1487.     ADRPARM         adrparm         = { 0 };
  1488.     LPADRLIST       lpAdrList       = NULL;
  1489.     ULONG           ulUIParam       = (ULONG)(void *)m_hWnd;
  1490.     HRESULT         hResult1        = hrSuccess;
  1491.     ULONG           ulRowCount      = 0;
  1492.     LPSRowSet       lpRows          = NULL;
  1493.     LONG            lRowsSeeked     = 0;                                
  1494.     CAdrListDlg     AdrList1(this);
  1495.     CAdrListDlg     AdrList2(this);
  1496.  
  1497.     // get all rows/recipients of the recipient table
  1498.     m_hResult = m_lpRecipTable->GetRowCount(0,&ulRowCount);
  1499.     wsprintf(m_szLogBuf,"lpRecipTable->GetRowCount(0,&ulRowCount)\t SC: %s",
  1500.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1501.     
  1502.     if( HR_FAILED(m_hResult))    
  1503.     {
  1504.         MessageBox( m_E.SzError("m_lpRecipTable->GetRowCount()", m_hResult), "Client", MBS_ERROR );
  1505.         goto Error;
  1506.     }
  1507.     
  1508.     // if there are rows, set lpAdrList to be entire rowset
  1509.     if( ulRowCount)
  1510.     {   
  1511.         m_hResult = m_lpRecipTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked);
  1512.  
  1513.         wsprintf(m_szLogBuf,"lpRecipTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked)\t SC: %s",
  1514.                             GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1515.  
  1516.         if( HR_FAILED(m_hResult))    
  1517.         {
  1518.             MessageBox( m_E.SzError("m_lpRecipTable->SeekRow", m_hResult), 
  1519.                                 "Client", MBS_ERROR );
  1520.             goto Error;
  1521.         }
  1522.  
  1523.         m_hResult = m_lpRecipTable->QueryRows( ulRowCount, 0, &lpRows );
  1524.  
  1525.         wsprintf(m_szLogBuf,"lpRecipTable->QueryRows( %lu, 0, &lpRows )\t SC: %s",
  1526.                             ulRowCount,
  1527.                             GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1528.  
  1529.         // we can caste a LPRowSet to a LPADRLIST
  1530.         lpAdrList = (LPADRLIST) lpRows;
  1531.     }
  1532.  
  1533.     // initalize data for dialog box
  1534.     OperName  = m_CurrentMessage;
  1535.     OperName += "->ModifyRecipients()";
  1536.  
  1537.     MsgModifyAttachDlg.m_CurrentOperation= OperName;
  1538.     MsgModifyAttachDlg.m_FlagText1       = "MODRECIP_ADD";
  1539.     MsgModifyAttachDlg.m_FlagText2       = "MODRECIP_MODIFY";
  1540.     MsgModifyAttachDlg.m_FlagText3       = "MODRECIP_REMOVE";
  1541.     MsgModifyAttachDlg.m_FlagText4       = "Invalid Flag";
  1542.  
  1543.                                  
  1544.     // bring up UI for determining what the ADDRESS LIST will look like
  1545.  
  1546.     rglpszDestTitles[0] = "To:";
  1547.     rglpszDestTitles[1] = "Cc:";
  1548.     rglpszDestTitles[2] = "Bcc:";
  1549.     
  1550.     rgulDestComps[0]    = MAPI_TO;
  1551.     rgulDestComps[1]    = MAPI_CC;
  1552.     rgulDestComps[2]    = MAPI_BCC;
  1553.  
  1554.     adrparm.cbABContEntryID     = 0;
  1555.     adrparm.lpABContEntryID     = NULL;
  1556.     adrparm.ulFlags             = DIALOG_MODAL;
  1557.     adrparm.lpReserved          = NULL;
  1558.     adrparm.ulHelpContext       = 0;
  1559.     adrparm.lpszHelpFileName    = NULL;
  1560.     adrparm.lpfnABSDI           = NULL;
  1561.     adrparm.lpfnDismiss         = NULL;
  1562.     adrparm.lpvDismissContext   = NULL;
  1563.     adrparm.lpszCaption         = "AddressBook";
  1564.     adrparm.lpszNewEntryTitle   = "MDB Viewer New Entry";
  1565.     adrparm.lpszDestWellsTitle  = "Destinations";
  1566.     adrparm.cDestFields         = 3;
  1567.     adrparm.nDestFieldFocus     = 0;
  1568.     adrparm.lppszDestTitles     = rglpszDestTitles;
  1569.     adrparm.lpulDestComps       = rgulDestComps;
  1570.     adrparm.lpContRestriction   = NULL;
  1571.     adrparm.lpHierRestriction   = NULL;
  1572.     adrparm.cDestFields         = (ULONG) 3;
  1573.  
  1574.              
  1575.     // display address list before
  1576.     AdrList1.m_List       = "Address List of Recipients in Message BEFORE";
  1577.     AdrList1.m_lpAdrList  = lpAdrList;
  1578.     AdrList1.DoModal();
  1579.  
  1580.     hResult1 = lpAdrBook->Address( &ulUIParam, &adrparm,&lpAdrList );
  1581.  
  1582.     wsprintf(m_szLogBuf,"lpAdrBook->Address(%lu,0x%X,&lpAdrList)\t SC: %s",
  1583.                ulUIParam,&adrparm,
  1584.                GetString( "MAPIErrors", GetScode(hResult1), m_szError ) );
  1585.     
  1586.     if( HR_FAILED(hResult1) )
  1587.     {
  1588.         MessageBox( m_E.SzError("lpAdrBook->Address()", hResult1), "Client", MB_OK );
  1589.         goto Error;
  1590.     }
  1591.  
  1592.  
  1593.     // display address list after
  1594.     AdrList2.m_List       = "Address List of Recipients in Message AFTER Address()";
  1595.     AdrList2.m_lpAdrList  = lpAdrList;
  1596.     AdrList2.DoModal();
  1597.  
  1598.     // bring up modal dialog box, and if user hits OK, process operation
  1599.     if( MsgModifyAttachDlg.DoModal() == IDOK )      
  1600.     {       
  1601.  
  1602.         // determine state/settings of data in dialog upon closing
  1603.                 
  1604.         if( MsgModifyAttachDlg.m_bFlag1 )                
  1605.             ulFlags |= MODRECIP_ADD;
  1606.  
  1607.         if( MsgModifyAttachDlg.m_bFlag2 )                
  1608.             ulFlags |= MODRECIP_MODIFY;
  1609.  
  1610.         if( MsgModifyAttachDlg.m_bFlag3 )                
  1611.             ulFlags |= MODRECIP_REMOVE;
  1612.  
  1613.         if( MsgModifyAttachDlg.m_bFlag4 )                
  1614.             ulFlags |= TEST_INVALID_FLAG;
  1615.  
  1616.         m_hResult = m_lpMessage->ModifyRecipients(
  1617.                         ulFlags,
  1618.                         lpAdrList );
  1619.  
  1620.          wsprintf(m_szLogBuf,"lpMessage->ModifyRecipients(%lu,0x%X)\t SC: %s",
  1621.                ulUIParam,lpAdrList,
  1622.                GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1623.         
  1624.         if( HR_FAILED(m_hResult) )
  1625.         {
  1626.             MessageBox( m_E.SzError("m_lpMessage->ModifyRecipients()", m_hResult), 
  1627.                             "Client", MBS_ERROR );
  1628.             goto Error;
  1629.         }        
  1630.     }
  1631.  
  1632.     DisplayMsgFlags();
  1633.  
  1634. Error:
  1635.  
  1636.     if(lpAdrList)
  1637.         FreeAdrList(lpAdrList);
  1638.  
  1639. }   
  1640. /********************************************************************/
  1641. /*
  1642.  -  CMessageDlg::
  1643.  -  OnRecipTable
  1644.  -
  1645.  *  Purpose:
  1646.  *  
  1647.  /********************************************************************/
  1648.  
  1649. void CMessageDlg::OnRecipTable()
  1650. {
  1651.     LPSPropTagArray lpsptaAll       = NULL;
  1652.     LONG            lRowsSeeked     = 0;
  1653.  
  1654.     m_hResult = m_lpRecipTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked);
  1655.  
  1656.     wsprintf(m_szLogBuf,"lpRecipTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked)\t SC: %s",
  1657.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1658.  
  1659.     if( HR_FAILED(m_hResult))    
  1660.     {
  1661.         MessageBox( m_E.SzError("m_lpRecipTable->SeekRow", m_hResult), 
  1662.                             "Client", MBS_ERROR );
  1663.         goto Error;
  1664.     }
  1665.  
  1666.     TBLVUViewMapiTable( (LPMAPITABLE FAR *)&m_lpRecipTable, (HWND)this->m_hWnd );
  1667.  
  1668. Error:
  1669.  
  1670.     // free Memory allocated
  1671.     if(lpsptaAll)
  1672.         MAPIFreeBuffer(lpsptaAll);    
  1673. }
  1674.  
  1675.  
  1676.  
  1677. /********************************************************************/
  1678. /*
  1679.  -  CMessageDlg::
  1680.  -  OnAttachTable
  1681.  -
  1682.  *  Purpose:
  1683.  *  
  1684.  /********************************************************************/
  1685.  
  1686. void CMessageDlg::OnAttachTable()
  1687. {
  1688.  
  1689.     LPSPropTagArray lpsptaAll       = NULL;
  1690.     LONG            lRowsSeeked     = 0;
  1691.  
  1692.     // PropTag Array for getting only attachment number USED IN SETCOLUMNS
  1693.     SizedSPropTagArray(1,sptaAttachNum) = 
  1694.     {
  1695.         1, 
  1696.         { 
  1697.             PR_ATTACH_NUM,
  1698.         }
  1699.     };
  1700.     
  1701.     // query all columns
  1702.     m_hResult = m_lpAttachTable->QueryColumns(TBL_ALL_COLUMNS, &lpsptaAll);
  1703.     wsprintf(m_szLogBuf,"lpAttachTable->QueryColumns(TBL_ALL_COLUMNS, &lpsptaAll)\t SC: %s",
  1704.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1705.  
  1706.     if( HR_FAILED(m_hResult))    
  1707.     {
  1708.         MessageBox( m_E.SzError("m_lpAttachTable->QueryColumns", m_hResult), 
  1709.                             "Client", MBS_ERROR );
  1710.         goto Error;
  1711.     }
  1712.     
  1713.     // set columns all columns
  1714.     m_hResult = m_lpAttachTable->SetColumns( (LPSPropTagArray) lpsptaAll, 0);
  1715.     wsprintf(m_szLogBuf,"lpAttachTable->SetColumns( &sptaAll, 0)\t SC: %s",
  1716.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1717.  
  1718.     if( HR_FAILED(m_hResult))    
  1719.     {
  1720.         MessageBox( m_E.SzError("m_lpAttachTable->SetColumns", m_hResult), 
  1721.                             "Client", MBS_ERROR );
  1722.         goto Error;
  1723.     }
  1724.  
  1725.     m_hResult = m_lpAttachTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked);
  1726.  
  1727.     wsprintf(m_szLogBuf,"lpAttachTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked)\t SC: %s",
  1728.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1729.  
  1730.     if( HR_FAILED(m_hResult))    
  1731.     {
  1732.         MessageBox( m_E.SzError("m_lpAttachTable->SeekRow", m_hResult), 
  1733.                             "Client", MBS_ERROR );
  1734.         goto Error;
  1735.     }
  1736.  
  1737.     TBLVUViewMapiTable( (LPMAPITABLE FAR *)&m_lpAttachTable, (HWND)this->m_hWnd );
  1738.  
  1739.     // set which columns are important to see in table     
  1740.     m_hResult = m_lpAttachTable->SetColumns( (LPSPropTagArray) &sptaAttachNum, 0);
  1741.     wsprintf(m_szLogBuf,"lpAttachTable->SetColumns( &sptaAttachNum, 0)\t SC: %s",
  1742.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1743.  
  1744.     if( HR_FAILED(m_hResult))    
  1745.     {
  1746.         MessageBox( m_E.SzError("m_lpAttachTable->SetColumns", m_hResult), 
  1747.                             "Client", MBS_ERROR );
  1748.         goto Error;
  1749.     }
  1750.  
  1751. Error:
  1752.  
  1753.     // free Memory allocated
  1754.     if(lpsptaAll)
  1755.         MAPIFreeBuffer(lpsptaAll);    
  1756.  
  1757. }
  1758.  
  1759. /*******************************************************************/
  1760. /*
  1761.  -  CMesageDlg::
  1762.  -  OnSetReadFlag
  1763.  *
  1764.  *  Purpose:
  1765.  *
  1766.  */
  1767. /*******************************************************************/
  1768.  
  1769. void CMessageDlg::OnSetReadFlag()
  1770. {   
  1771.     COperation      SetReadFlagDlg(this);
  1772.     CString         OperName;
  1773.     ULONG           ulFlags         = 0;
  1774.  
  1775.     // initalize data for dialog box
  1776.     OperName  = m_CurrentMessage;
  1777.     OperName += "->SetReadFlag()";
  1778.  
  1779.     SetReadFlagDlg.m_CurrentOperation= OperName;
  1780.     SetReadFlagDlg.m_FlagText1       = "SUPPRESS_RECEIPT";
  1781.     SetReadFlagDlg.m_FlagText2       = "CLEAR_READ_FLAG";
  1782.     SetReadFlagDlg.m_FlagText3       = "MESSAGE_DIALOG";
  1783.     SetReadFlagDlg.m_FlagText4       = "MAPI_DEFERRED_ERRORS";
  1784.     SetReadFlagDlg.m_FlagText5       = "GENERATE_RECEIPT_ONLY";
  1785.     SetReadFlagDlg.m_FlagText6       = "Invalid Flag";
  1786.                                                  
  1787.     // bring up modal dialog box, and if user hits OK, process operation
  1788.     if( SetReadFlagDlg.DoModal() == IDOK )      
  1789.     {       
  1790.         // determine state/settings of data in dialog upon closing
  1791.                 
  1792.         if( SetReadFlagDlg.m_bFlag1 )                
  1793.             ulFlags |= SUPPRESS_RECEIPT;
  1794.  
  1795.         if( SetReadFlagDlg.m_bFlag2 )                
  1796.             ulFlags |= CLEAR_READ_FLAG;
  1797.  
  1798.         if( SetReadFlagDlg.m_bFlag3 )                
  1799.             ulFlags |= MESSAGE_DIALOG;
  1800.  
  1801.         if( SetReadFlagDlg.m_bFlag4 )                
  1802.             ulFlags |= MAPI_DEFERRED_ERRORS;
  1803.  
  1804.         if( SetReadFlagDlg.m_bFlag5 )                
  1805.             ulFlags |= GENERATE_RECEIPT_ONLY;
  1806.  
  1807.         if( SetReadFlagDlg.m_bFlag6 )                
  1808.             ulFlags |= TEST_INVALID_FLAG;
  1809.  
  1810.         m_hResult = m_lpMessage->SetReadFlag(ulFlags);
  1811.  
  1812.         wsprintf(m_szLogBuf,"lpMessage->SetReadFlag(%lu)\t SC: %s",
  1813.                         ulFlags,
  1814.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1815.  
  1816.         if( HR_FAILED(m_hResult))    
  1817.         {
  1818.             MessageBox( m_E.SzError("m_lpMessage->SetReadFlag()", m_hResult), 
  1819.                             "Client", MBS_ERROR );
  1820.             return;
  1821.         }        
  1822.         RedrawPropTable();
  1823.     }        
  1824.     DisplayMsgFlags();
  1825.  
  1826. }   
  1827.  
  1828. /*******************************************************************/
  1829. /*
  1830.  -  CMesageDlg::
  1831.  -  OnDeleteAttach
  1832.  *
  1833.  *  Purpose:
  1834.  *      Operation lpMessage->DeleteAttachment
  1835.  */
  1836. /*******************************************************************/
  1837.  
  1838. void CMessageDlg::OnDeleteAttach()
  1839. {   
  1840.     COperation      DeleteAttachDlg(this);
  1841.     CString         OperName;
  1842.     int             dRet            = 0;
  1843.     LONG            lCurSelect      = -1;
  1844.     ULONG           ulFlags         = 0;
  1845.     ULONG           ulUIParam       = 0;
  1846.     LPSRowSet       lpRows          = NULL;
  1847.     LONG            lRowsSeeked     = 0;
  1848.     LONG            lAttachNum      = -1;
  1849.     ULONG           iRow            = 0;
  1850.     char            szBuff[80];
  1851.     ULONG           ulRefCount      = 0;
  1852.     
  1853.   
  1854.     //$ NYI, FIX UP LPMAPIPROGRESS 
  1855.     LPMAPIPROGRESS  lpProgress       = NULL;
  1856.     
  1857.     // PropTag Array for getting only attachment number
  1858.     SizedSPropTagArray(1,sptaAttachNum) = 
  1859.     {
  1860.         1, 
  1861.         { 
  1862.             PR_ATTACH_NUM,
  1863.         }
  1864.     };
  1865.     
  1866.     // get selected item from child folder listbox
  1867.     if( (lCurSelect = SendDlgItemMessage(IDC_MSGATTACH,LB_GETCURSEL,0,0 )) < 0 )
  1868.     {
  1869.         MessageBox("Select a Attachment in Listbox to DeleteAttach", "OnDeleteAttach", MBS_ERROR );
  1870.         return;
  1871.     }
  1872.  
  1873.     m_hResult = m_lpAttachTable->SeekRow( BOOKMARK_BEGINNING,lCurSelect,&lRowsSeeked);
  1874.  
  1875.     wsprintf(m_szLogBuf,"lpAttachTable->SeekRow( BOOKMARK_BEGINNING,%ld,&lRowsSeeked)\t SC: %s",
  1876.                         lCurSelect,
  1877.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1878.  
  1879.     if( HR_FAILED(m_hResult))    
  1880.     {
  1881.         MessageBox( m_E.SzError("m_lpAttachTable->SeekRow", m_hResult), 
  1882.                             "Client", MBS_ERROR );
  1883.         goto Error;
  1884.     }
  1885.  
  1886.     m_hResult = m_lpAttachTable->QueryRows( 1, 0, &lpRows );
  1887.  
  1888.     wsprintf(m_szLogBuf,"lpAttachTable->QueryRows( 1, 0, &lpRows )\t SC: %s",
  1889.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1890.  
  1891.     if( HR_FAILED(m_hResult))    
  1892.  
  1893.     {
  1894.         MessageBox( m_E.SzError("m_lpAttachTable->QueryRows", m_hResult), 
  1895.                             "Client", MBS_ERROR );
  1896.         goto Error;
  1897.     }
  1898.  
  1899.     // now open attachment based upon PR_ATTACHMENT_NUM from m_lpAttachmentTable
  1900.     if ( lpRows->aRow[iRow].lpProps[0].ulPropTag == PR_ATTACH_NUM )
  1901.         lAttachNum = lpRows->aRow[iRow].lpProps[0].Value.l ;
  1902.  
  1903.     if(lAttachNum == -1)
  1904.     {
  1905.         MessageBox( m_E.SzError("Could not find PR_ATTACH_NUM in m_lpAttachTable ",m_hResult), 
  1906.                             "Client", MBS_ERROR );
  1907.         goto Error;
  1908.     }   
  1909.                                    
  1910.     // initalize data for dialog box
  1911.     OperName  = m_CurrentMessage;
  1912.     OperName += "->DeleteAttach()";
  1913.  
  1914.     DeleteAttachDlg.m_CurrentOperation= OperName;
  1915.     DeleteAttachDlg.m_CBText1         = "ulUIParam";
  1916.     DeleteAttachDlg.m_EditText1       = "lAttachmentNum";
  1917.     DeleteAttachDlg.m_FlagText1       = "ATTACH_DIALOG";
  1918.     DeleteAttachDlg.m_FlagText2       = "Invalid Flag";
  1919.     
  1920.     wsprintf(szBuff,"%d",lAttachNum);
  1921.     DeleteAttachDlg.m_EditDefault1    = szBuff;
  1922.     DeleteAttachDlg.m_EditDefault2    = "";
  1923.     DeleteAttachDlg.m_EditDefault3    = "";
  1924.         
  1925.     dRet = DeleteAttachDlg.m_CBContents1.Add("NULL");
  1926.     wsprintf(szBuff,"Parent hWnd == %X",this->m_hWnd);
  1927.     dRet = DeleteAttachDlg.m_CBContents1.Add(szBuff);
  1928.  
  1929.     // bring up modal dialog box, and if user hits OK, process operation
  1930.     if( DeleteAttachDlg.DoModal() == IDOK )      
  1931.     {       
  1932.         // determine state/settings of data in dialog upon closing
  1933.  
  1934.         if( !lstrcmp(DeleteAttachDlg.m_szCB1,"NULL") )
  1935.             ulUIParam = (ULONG)NULL;
  1936.         else
  1937.             ulUIParam = (ULONG)(void *)this->m_hWnd;                    
  1938.  
  1939.         if( DeleteAttachDlg.m_bFlag1 )                
  1940.             ulFlags |= ATTACH_DIALOG;
  1941.  
  1942.         if( DeleteAttachDlg.m_bFlag2 )                
  1943.             ulFlags |= TEST_INVALID_FLAG;
  1944.  
  1945.         m_hResult = m_lpMessage->DeleteAttach(lAttachNum,ulUIParam,
  1946.                         lpProgress,ulFlags);
  1947.                         
  1948.         wsprintf(m_szLogBuf,"lpMessage->DeleteAttach(%lu,%lu,0x%X,%lu)\t SC: %s",
  1949.                         lAttachNum,ulUIParam,lpProgress,ulFlags,
  1950.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  1951.  
  1952.         if( HR_FAILED(m_hResult))                            
  1953.         {
  1954.             MessageBox( m_E.SzError("m_lpMessage->DeleteAttach()", m_hResult), 
  1955.                             "Client", MBS_ERROR );
  1956.             return;
  1957.         }        
  1958.     }        
  1959.  
  1960.     DisplayMsgFlags();
  1961.  
  1962. Error:
  1963.  
  1964.     FreeRowSet(lpRows);
  1965. }   
  1966.  
  1967.  
  1968. /*******************************************************************/
  1969. /*
  1970.  -  CMessageDlg::
  1971.  -  OnCreateAttach
  1972.  *
  1973.  *  Purpose:
  1974.  *      Operation lpMessage->CreateAttachment
  1975.  */
  1976. /*******************************************************************/
  1977.  
  1978. void CMessageDlg::OnCreateAttach()
  1979. {   
  1980.     COperation      CreateAttDlg(this);
  1981.     CString         OperName;
  1982.     int             dRet            = 0;
  1983.     LONG            lCurSelect      = 0;
  1984.     LPIID           lpInterface     = NULL;
  1985.     ULONG           ulFlags         = 0;
  1986.     LPATTACH        lpAttach        = NULL;
  1987.     ULONG           ulAttachNum     = 0;
  1988.     ULONG           idx             = 0;
  1989.     CAttachDlg      *lpAttachDlg    = NULL;
  1990.  
  1991.     
  1992.     // initalize data for dialog box
  1993.  
  1994.     OperName  = m_CurrentMessage;
  1995.     OperName += "->CreateAttach()";
  1996.  
  1997.     CreateAttDlg.m_CurrentOperation= OperName;
  1998.  
  1999.     CreateAttDlg.m_CBText1         = "lpInterface";
  2000.     CreateAttDlg.m_FlagText1       = "MAPI_DEFERRED_ERRORS";
  2001.     CreateAttDlg.m_FlagText2       = "Invalid Flag";
  2002.     
  2003.     dRet = CreateAttDlg.m_CBContents1.Add("NULL");
  2004.     dRet = CreateAttDlg.m_CBContents1.Add("Bad Interface");
  2005.             
  2006.     // bring up modal dialog box, and if user hits OK, process operation
  2007.     if( CreateAttDlg.DoModal() == IDOK )      
  2008.     {       
  2009.  
  2010.         // determine state/settings of data in dialog upon closing
  2011.         if( !lstrcmp(CreateAttDlg.m_szCB1,"NULL") )
  2012.             lpInterface = NULL;
  2013.         else
  2014.             lpInterface = (LPIID) &ulFlags;         // invalid
  2015.                
  2016.         if( CreateAttDlg.m_bFlag1 )                
  2017.             ulFlags |= MAPI_DEFERRED_ERRORS;
  2018.             
  2019.         if( CreateAttDlg.m_bFlag2)
  2020.             ulFlags |= TEST_INVALID_FLAG;
  2021.  
  2022.         m_hResult = m_lpMessage->CreateAttach(
  2023.                         lpInterface,
  2024.                         ulFlags,
  2025.                         &ulAttachNum,
  2026.                         &lpAttach);
  2027.  
  2028.         wsprintf(m_szLogBuf,"lpMessage->CreateAttach(0x%X,%lu,&ulAttachNum,&lpAttach)\t SC: %s",
  2029.                         lpInterface,ulFlags,
  2030.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2031.  
  2032.         if( HR_FAILED(m_hResult))                                                    
  2033.         {
  2034.             MessageBox( m_E.SzError("m_lpMessage->CreateAttach()", m_hResult), 
  2035.                             "Client", MBS_ERROR );
  2036.             return;
  2037.         }
  2038.  
  2039.         lpAttachDlg   =  new CAttachDlg("MAPI_ATTACH",(LPATTACH)lpAttach,this);
  2040.     }
  2041.  
  2042.     DisplayMsgFlags();
  2043.  
  2044. }   
  2045.  
  2046. /*******************************************************************/
  2047. /*
  2048.  -  CMesageDlg::
  2049.  -  OnSubmitMessage
  2050.  *
  2051.  *  Purpose:
  2052.  *      Operation lpMessage->SubmitMessage
  2053.  */
  2054. /*******************************************************************/
  2055.  
  2056. void CMessageDlg::OnSubmitMessage()
  2057. {   
  2058.     COperation      MsgSubmitMessageDlg(this);
  2059.     CString         OperName;
  2060.     int             dRet            = 0;
  2061.     LONG            lCurSelect      = -1;
  2062.     ULONG           ulFlags         = 0;
  2063.  
  2064.                                
  2065.     // initalize data for dialog box
  2066.     OperName  = m_CurrentMessage;
  2067.     OperName += "->SubmitMessage()";
  2068.  
  2069.     MsgSubmitMessageDlg.m_CurrentOperation= OperName;
  2070.     MsgSubmitMessageDlg.m_FlagText1       = "FORCE_SUBMIT";
  2071.     MsgSubmitMessageDlg.m_FlagText2       = "Invalid Flag";
  2072.                                                  
  2073.     // bring up modal dialog box, and if user hits OK, process operation
  2074.     if( MsgSubmitMessageDlg.DoModal() == IDOK )      
  2075.     {                                        
  2076.         if( MsgSubmitMessageDlg.m_bFlag1 )                
  2077.             ulFlags |= FORCE_SUBMIT;
  2078.  
  2079.         if( MsgSubmitMessageDlg.m_bFlag2 )                
  2080.             ulFlags |= TEST_INVALID_FLAG;
  2081.  
  2082.         if( m_hResult = m_lpMessage->SubmitMessage(ulFlags) )
  2083.  
  2084.  
  2085.         wsprintf(m_szLogBuf,"lpMessage->SubmitMessage(%lu)\t SC: %s",
  2086.                         ulFlags,
  2087.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2088.  
  2089.         if( HR_FAILED(m_hResult))                                                            
  2090.         {
  2091.             MessageBox( m_E.SzError("m_lpMessage->SubmitMessage()", m_hResult), 
  2092.                             "Client", MBS_ERROR );
  2093.             return;
  2094.         }          
  2095.     }        
  2096.  
  2097. }   
  2098.  
  2099.  
  2100. /*******************************************************************/
  2101. /*
  2102.  -  CMessageDlg::
  2103.  -  OnOpenAttachLB
  2104.  *
  2105.  *  Purpose:
  2106.  *      Allow user to OpenAttachLB a message with a OpenAttachLB note
  2107.  *
  2108.  *  Parameters:
  2109.  *      None
  2110.  *
  2111.  *  Returns:
  2112.  *      Nothing
  2113.  *
  2114.  */
  2115. /*******************************************************************/
  2116.  
  2117. void CMessageDlg::OnOpenAttachLB()
  2118. {
  2119.     char            szBuff[30];
  2120.     LONG            lSelection      = -1;
  2121.     LPATTACH        lpAttach        = NULL;
  2122.     LPSRowSet       lpRows          = NULL;
  2123.     ULONG           ulValues        = 0;
  2124.     ULONG           ulRefCount      = 0;
  2125.     CAttachDlg      *lpAttachDlg    = NULL;
  2126.     LONG            lRowsSeeked     = 0;
  2127.     LONG            lAttachNum      = -1;
  2128.     ULONG           iRow            = 0;
  2129.     ULONG           cColumn         = 0;
  2130.     LPSPropValue    lpPropValue     = NULL;
  2131.     char            szBuffer[80];
  2132.  
  2133.     // PropTag Array for getting only Attach Pathname and Position
  2134.     SizedSPropTagArray(3,sptaAttachPathname) = 
  2135.     {
  2136.         3, 
  2137.         { 
  2138.             PR_ATTACH_PATHNAME,
  2139.             PR_RENDERING_POSITION,
  2140.             PR_OBJECT_TYPE,
  2141.         }
  2142.     };
  2143.  
  2144.     // PropTag Array for getting only attachment number
  2145.     SizedSPropTagArray(1,sptaAttachNum) = 
  2146.     {
  2147.         1, 
  2148.         { 
  2149.             PR_ATTACH_NUM,
  2150.         }
  2151.     };
  2152.  
  2153.     
  2154.  
  2155.     // get selected item
  2156.     if( (lSelection = SendDlgItemMessage(IDC_MSGATTACH,LB_GETCURSEL,0,0 )) < 0 )
  2157.     {
  2158.         MessageBox("Please Select a Attachment in Listbox to Open",
  2159.                          "OnOpenAttach", MBS_ERROR );
  2160.         goto Error;
  2161.     }
  2162.  
  2163.     m_hResult = m_lpAttachTable->SeekRow( BOOKMARK_BEGINNING,lSelection,&lRowsSeeked);
  2164.                                                                     
  2165.     wsprintf(m_szLogBuf,"lpAttachTable->SeekRow( BOOKMARK_BEGINNING,%ld,&lRowsSeeked)\t SC: %s",
  2166.                         lSelection,
  2167.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2168.  
  2169.     if( HR_FAILED(m_hResult))    
  2170.     {
  2171.         MessageBox( m_E.SzError("m_lpAttachTable->SeekRow", m_hResult), 
  2172.                             "Client", MBS_ERROR );
  2173.         goto Error;
  2174.     }
  2175.  
  2176.     m_hResult = m_lpAttachTable->QueryRows( 1, 0, &lpRows );
  2177.  
  2178.     wsprintf(m_szLogBuf,"lpAttachTable->QueryRows( 1, 0, &lpRows )\t SC: %s",
  2179.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2180.  
  2181.     if( HR_FAILED(m_hResult))    
  2182.     {
  2183.         MessageBox( m_E.SzError("m_lpAttachTable->QueryRows", m_hResult), 
  2184.                             "Client", MBS_ERROR );
  2185.         goto Error;
  2186.     }
  2187.  
  2188.     // now open attachment based upon PR_ATTACHMENT_NUM from m_lpAttachmentTable
  2189.     if ( lpRows->aRow[iRow].lpProps[0].ulPropTag == PR_ATTACH_NUM )
  2190.         lAttachNum = lpRows->aRow[iRow].lpProps[0].Value.l ;
  2191.  
  2192.     if(lAttachNum == -1)
  2193.     {
  2194.         MessageBox( m_E.SzError("Could not find PR_ATTACH_NUM in m_lpAttachTable ",m_hResult), 
  2195.                             "Client", MBS_ERROR );
  2196.         goto Error;
  2197.     }   
  2198.         
  2199.     m_hResult = m_lpMessage->OpenAttach( lAttachNum , NULL, ulAccess, &lpAttach);
  2200.  
  2201.     wsprintf(m_szLogBuf,"lpMessage->OpenAttach( %ld , NULL, %lu, &lpAttach)\t SC: %s",
  2202.                         lAttachNum,ulAccess,
  2203.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2204.  
  2205.     if( HR_FAILED(m_hResult))        
  2206.     {
  2207.         MessageBox( m_E.SzError("OpenAttach()", m_hResult), "Client", MBS_ERROR );
  2208.         goto Error;
  2209.     }
  2210.  
  2211.     m_hResult = lpAttach->GetProps((LPSPropTagArray) &sptaAttachPathname,0, &ulValues, &lpPropValue);
  2212.     wsprintf(m_szLogBuf,"lpAttach->GetProps(&sptaAttachPathname,0, &ulValues, &lpPropValue)\t SC: %s",
  2213.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2214.  
  2215.     // COMMENT OUT ???
  2216.     if( HR_FAILED(m_hResult))        
  2217.     {
  2218.         MessageBox( m_E.SzError("CMessageDlg::OnOpenAttachLB()  lpAttach->GetProps()", m_hResult),
  2219.                      "Client", MBS_ERROR );
  2220.         goto Error;
  2221.     }
  2222.  
  2223.     if (lpRows->aRow[0].lpProps[0].ulPropTag == PR_SUBJECT )
  2224.     {
  2225.         wsprintf(szBuffer,"%s - %s", 
  2226.                 GetString("MAPIObjTypes",lpPropValue[2].Value.l,NULL),
  2227.                 lpPropValue[0].Value.lpszA);
  2228.     }    
  2229.     else
  2230.     {
  2231.         wsprintf(szBuff,"AttachNum == %d",lAttachNum);
  2232.         wsprintf(szBuffer,"%s - %s", 
  2233.                 GetString("MAPIObjTypes",lpPropValue[2].Value.l,NULL),
  2234.                 szBuff);
  2235.     }            
  2236.  
  2237.     lpAttachDlg   =  new CAttachDlg(szBuffer,(LPATTACH)lpAttach,this);
  2238.  
  2239.     FreeRowSet( lpRows );
  2240.  
  2241.     if(lpPropValue)
  2242.         MAPIFreeBuffer(lpPropValue);
  2243.  
  2244.     return;
  2245.  
  2246. Error:
  2247.  
  2248.     if(lpPropValue)
  2249.     {
  2250.         MAPIFreeBuffer(lpPropValue);
  2251.         wsprintf(m_szLogBuf,"MAPIFreeBuffer(%s)", "lpPropValue from GetProps" );
  2252.     }
  2253.  
  2254.     FreeRowSet( lpRows );
  2255.  
  2256.     if(lpAttach)
  2257.     {
  2258.         lpAttach->Release();
  2259.         lpAttach = NULL;
  2260.     }
  2261. }
  2262.  
  2263. /*******************************************************************/
  2264. /*
  2265.  -  CMessageDlg::
  2266.  -  OnCancel
  2267.  -
  2268.  *  Purpose:
  2269.  *      Closes the message dialog.
  2270.  *
  2271.  */
  2272. /*******************************************************************/
  2273.  
  2274. void CMessageDlg::OnCancel()
  2275. {
  2276.     delete this;
  2277. }
  2278.  
  2279. /*******************************************************************/
  2280. /*
  2281.  -  CMessageDlg::
  2282.  -  Cleanup
  2283.  -
  2284.  *  Purpose:
  2285.  *      Cleanup called by destructor for class CMessageDlg.  
  2286.  *      Releases and Frees memory allocated in class
  2287.  *
  2288.  */
  2289. /*******************************************************************/
  2290.  
  2291. void CMessageDlg::Cleanup()
  2292. {     
  2293. #ifdef XVPORT
  2294.  
  2295.     UnadviseAll(m_lpRecipTable, MAPI_TABLE,"RecipientTable lpTable",    &m_lpNotifRecipTbl);
  2296.     UnadviseAll(m_lpAttachTable,MAPI_TABLE,"AttachmentTable lpTable",   &m_lpNotifAttTbl);
  2297.     
  2298.     if(m_lpMessage)    
  2299.         UnadviseAll(lpMDB,          MAPI_STORE,"Message Objs lpMDB",        &m_lpNotifMsg);
  2300.  
  2301. #endif
  2302.     // table obtained from GetAttachmentTable                               
  2303.     if(m_lpAttachTable)
  2304.     {    
  2305.         m_lpAttachTable->Release();
  2306.         m_lpAttachTable = NULL;
  2307.     }
  2308.  
  2309.     // table obtained from GetRecipientTable
  2310.     if(m_lpRecipTable)
  2311.     {
  2312.         m_lpRecipTable->Release();
  2313.         m_lpRecipTable = NULL;
  2314.     }
  2315.     
  2316.     // message object
  2317.     if(m_lpMessage)
  2318.     {
  2319.         m_lpMessage->Release();
  2320.         m_lpMessage     = NULL; 
  2321.     }
  2322. }
  2323.  
  2324. /********************************************************************/
  2325. /*
  2326.  -  CMessageDlg::
  2327.  -  DisplayAttachments  (INTERNAL, protected member function)
  2328.  -
  2329.  *  Purpose:
  2330.  *      Display Attachments contained in message
  2331.  *
  2332.  *  Returns:
  2333.  *      Nothing
  2334.  */     
  2335. /********************************************************************/
  2336.  
  2337. void CMessageDlg::DisplayAttachments()
  2338. {
  2339.     ULONG           cColumn         = 0;
  2340.     int             iRow            = 0;
  2341.     LPATTACH        lpAttach        = NULL;
  2342.     LPSRowSet       lpRows          = NULL;
  2343.     ULONG           ulValues        = 0;
  2344.     LPSPropValue    lpPropValue     = NULL;
  2345.     DWORD           dwReturn        = 0;
  2346.     LONG            lAttachNum      = -1;
  2347.     LPSPropValue    lpPV            = NULL;
  2348.     LPSPropTagArray lpPropTags      = NULL;
  2349.     char            szBuff[80];   
  2350.     LONG            lRowsSeeked     = 0;
  2351.     ULONG           ulRowCount      = 0;
  2352.  
  2353.     // PropTag Array for getting only Attach Pathname and Position USED IN GETPROPS
  2354.     SizedSPropTagArray(2,sptaAttachPathname) = 
  2355.     {
  2356.         2, 
  2357.         { 
  2358.             PR_ATTACH_PATHNAME,
  2359.             PR_RENDERING_POSITION,
  2360.         }
  2361.     };
  2362.     
  2363.  
  2364.     dwReturn = SendDlgItemMessage(IDC_MSGATTACH,LB_RESETCONTENT,0,0);
  2365.  
  2366.     m_hResult = m_lpAttachTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked);
  2367.                                                                     
  2368.     wsprintf(m_szLogBuf,"lpAttachTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked)\t SC: %s",
  2369.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2370.  
  2371.     if( HR_FAILED(m_hResult))    
  2372.     {
  2373.         MessageBox( m_E.SzError("m_lpAttachTable->SeekRow", m_hResult), 
  2374.                             "Client", MBS_ERROR );
  2375.         goto Error;
  2376.     }
  2377.  
  2378.  
  2379.  
  2380.     m_hResult = m_lpAttachTable->GetRowCount(0,&ulRowCount);
  2381.     wsprintf(m_szLogBuf,"lpAttachTable->GetRowCount(0,&ulRowCount)\t SC: %s",
  2382.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2383.     
  2384.     if( HR_FAILED(m_hResult))    
  2385.     {
  2386.         MessageBox( m_E.SzError("m_lpAttachTable->GetRowCount()", m_hResult), "Client", MBS_ERROR );
  2387.         goto Error;
  2388.     }
  2389.        
  2390.     m_hResult = m_lpAttachTable->QueryRows( ulRowCount, 0, &lpRows );
  2391.  
  2392.     wsprintf(m_szLogBuf,"lpAttachTable->QueryRows( %lu, 0, &lpRows )\t SC: %s",ulRowCount,
  2393.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2394.     
  2395.     if( !HR_FAILED(m_hResult) )
  2396.     {
  2397.  
  2398.         // for each attachment , open it, getprops and get PATHNAME and display in listbox
  2399.         for( iRow = 0 ; iRow < lpRows->cRows ; iRow++ )
  2400.         {
  2401.             lAttachNum = -1;
  2402.             // now open attachment based upon PR_ATTACHMENT_NUM from m_lpAttachmentTable
  2403.             
  2404.             lpPV = lpRows->aRow[iRow].lpProps;
  2405.         
  2406.             for(cColumn = 0; cColumn < lpRows->aRow[iRow].cValues; cColumn++, lpPV++)
  2407.             {
  2408.                 if ( lpPV->ulPropTag == PR_ATTACH_NUM )
  2409.                 {
  2410.                     lAttachNum = lpPV->Value.l ;
  2411.                     break;
  2412.                 }
  2413.             }
  2414.             if(lAttachNum == -1)
  2415.             {
  2416.                 MessageBox( m_E.SzError("Could not find PR_ATTACH_NUM in m_lpAttachTable ",m_hResult), 
  2417.                                     "Client", MBS_ERROR );
  2418.                 goto Error;
  2419.             }   
  2420.             
  2421.             m_hResult = m_lpMessage->OpenAttach( lAttachNum , NULL, 0, &lpAttach);
  2422.             wsprintf(m_szLogBuf,"lpMessage->OpenAttach(%ld , NULL, 0, &lpAttach)\t SC: %s",
  2423.                         lAttachNum,
  2424.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2425.         
  2426.             if( HR_FAILED(m_hResult))    
  2427.             {
  2428.                 MessageBox( m_E.SzError("OpenAttach()", m_hResult), "Client", MBS_ERROR );
  2429.                 goto Error;
  2430.             }   
  2431.  
  2432.             m_hResult = lpAttach->GetProps( (LPSPropTagArray) &sptaAttachPathname,0, &ulValues, &lpPropValue);          
  2433.  
  2434.             wsprintf(m_szLogBuf,"lpAttach->GetProps(&sptaAttachPathname,0, &ulValues, &lpPropValue)\t SC: %s",
  2435.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2436.             
  2437.             // COMMENT OUT ??
  2438.             if( HR_FAILED(m_hResult))    
  2439.             {
  2440.                 MessageBox( m_E.SzError("CMessageDlg::OnOpenAttachLB()  lpAttach->GetProps()", m_hResult),
  2441.                      "Client", MBS_ERROR );
  2442.                 goto Error;
  2443.             }
  2444.  
  2445.             if( (PROP_TYPE(lpPropValue[0].ulPropTag) != PT_ERROR) &&
  2446.                 (PROP_TYPE(lpPropValue[0].ulPropTag) != PT_NULL) )
  2447.             {
  2448.                 dwReturn = SendDlgItemMessage(IDC_MSGATTACH,LB_ADDSTRING,0,
  2449.                         (LPARAM)lpPropValue[0].Value.lpszA );
  2450.             }
  2451.             else
  2452.             {
  2453.                 wsprintf(szBuff,"AttachNum == %d",lAttachNum);
  2454.                 dwReturn = SendDlgItemMessage(IDC_MSGATTACH,LB_ADDSTRING,0,
  2455.                         (LPARAM)szBuff );
  2456.  
  2457.             }
  2458.                        
  2459.             if(lpAttach)
  2460.             {
  2461.                 lpAttach->Release();
  2462.                 lpAttach = NULL;    
  2463.             }
  2464.         } // for loop on rows of attachment table
  2465.     }  // if queryrows successful
  2466. Error:
  2467.  
  2468.     if(lpPropValue)
  2469.     {
  2470.         MAPIFreeBuffer(lpPropValue);
  2471.         wsprintf(m_szLogBuf,"MAPIFreeBuffer(%s)", "lpPropValue from GetProps" );
  2472.     }
  2473.  
  2474.     FreeRowSet( lpRows );
  2475.  
  2476.     if(lpAttach)
  2477.     {
  2478.         lpAttach->Release();
  2479.         lpAttach = NULL;    
  2480.     }
  2481. }
  2482.  
  2483.  
  2484.  
  2485.  
  2486. /********************************************************************/
  2487. /*
  2488.  -  CMessageDlg::
  2489.  -  DisplayRecips   (INTERNAL, protected member function)
  2490.  -
  2491.  *  Purpose:
  2492.  *      Display Recipient Columns and recipients
  2493.  *
  2494.  *  Returns:
  2495.  *      Nothing
  2496.  */
  2497. /********************************************************************/
  2498.  
  2499. void CMessageDlg::DisplayRecips()
  2500. {
  2501.     int             iRow            = 0;
  2502.     LPSRowSet       lpRows          = NULL;
  2503.     DWORD           dwReturn        = 0;
  2504.     LONG            lRowsSeeked     = 0;
  2505.     LPSPropValue    lpPropValue     = NULL;
  2506.     ULONG           ulColumnDisplayName = 0;
  2507.     ULONG           idx             = 0;
  2508.     LPSPropTagArray lpsptaAll       = NULL;
  2509.  
  2510.     dwReturn = SendDlgItemMessage(IDC_MSGRECIPIENTS,LB_RESETCONTENT,0,0);
  2511.  
  2512.     m_hResult = m_lpRecipTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked);
  2513.                                                                     
  2514.     wsprintf(m_szLogBuf,"lpRecipTable->SeekRow( BOOKMARK_BEGINNING,0,&lRowsSeeked)\t SC: %s",
  2515.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2516.  
  2517.     if( HR_FAILED(m_hResult))    
  2518.     {
  2519.         MessageBox( m_E.SzError("m_lpRecipTable->SeekRow", m_hResult), 
  2520.                             "Client", MBS_ERROR );
  2521.         goto Error;
  2522.     }
  2523.  
  2524.     m_hResult = m_lpRecipTable->QueryRows( 100, 0, &lpRows );
  2525.  
  2526.     wsprintf(m_szLogBuf,"lpRecipTable->QueryRows( 100, 0, &lpRows )\t SC: %s",
  2527.                         GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2528.     
  2529.     if( !HR_FAILED(m_hResult) )
  2530.     {           
  2531.         // make sure we have some rows before trying to reference columns of rows
  2532.         if(lpRows->cRows == 0)
  2533.             goto Error;
  2534.  
  2535.         // query columns to determine how many columns there are
  2536.         m_hResult = m_lpRecipTable->QueryColumns(TBL_ALL_COLUMNS, &lpsptaAll);
  2537.         wsprintf(m_szLogBuf,"lpRecipTable->QueryColumns(TBL_ALL_COLUMNS, &lpsptaAll)\t SC: %s",
  2538.                             GetString( "MAPIErrors", GetScode(m_hResult), m_szError ) );
  2539.         
  2540.         if( HR_FAILED(m_hResult))    
  2541.         {
  2542.             MessageBox( m_E.SzError("m_lpRecipTable->QueryColumns", m_hResult), 
  2543.                                 "Client", MBS_ERROR );
  2544.             goto Error;
  2545.         }
  2546.     
  2547.         // search all columns for PR_DISPLAY_NAME to determine name to display in listbox
  2548.         for(idx = 0; idx < lpsptaAll->cValues ; ++idx)
  2549.         {
  2550.             if(lpRows->aRow[0].lpProps[idx].ulPropTag == PR_DISPLAY_NAME)
  2551.                 break;
  2552.         }            
  2553.         
  2554.         // if we could not find PR_DISPLAY_NAME, dump out
  2555.         if(idx == lpsptaAll->cValues )
  2556.             goto Error;
  2557.         
  2558.         for(iRow = 0; iRow < lpRows->cRows; ++iRow)
  2559.         {
  2560.             lpPropValue = lpRows->aRow[iRow].lpProps;
  2561.         
  2562.             if (lpPropValue[idx].ulPropTag == PR_DISPLAY_NAME )             
  2563.             {
  2564.                 dwReturn = SendDlgItemMessage(IDC_MSGRECIPIENTS,LB_ADDSTRING,0,
  2565.                             (LPARAM)lpPropValue[idx].Value.lpszA );                 
  2566.             }
  2567.         
  2568.         }
  2569.     }        
  2570.  
  2571. Error:
  2572.  
  2573.     FreeRowSet(lpRows);
  2574.  
  2575.     if(lpsptaAll)
  2576.         MAPIFreeBuffer(lpsptaAll);
  2577. }     
  2578.  
  2579.                    
  2580. /*******************************************************************/
  2581. /*
  2582.  -  CMessageDlg::
  2583.  -
  2584.  -  OnAttachLB
  2585.  -  OnAttachLB
  2586.  -  OnProperty
  2587.  -  OnFocus
  2588.  *
  2589.  *  Purpose:
  2590.  *      Disables/enables appropriate buttons and sets current selected
  2591.  *      listbox states
  2592.  *
  2593.  *  Parameters:
  2594.  *      None
  2595.  *
  2596.  *  Returns:
  2597.  *      Nothing
  2598.  *
  2599.  */
  2600. /*******************************************************************/
  2601. /*******************************************************************/
  2602.  
  2603. void CMessageDlg::OnAttachLB()
  2604. {
  2605.     DWORD   dwReturn    = 0;
  2606.  
  2607.     dwReturn = SendDlgItemMessage(IDC_MSGRECIPIENTS,LB_SETCURSEL,(WPARAM)-1,0);
  2608.     dwReturn = SendDlgItemMessage(IDC_PROPS,        LB_SETCURSEL,(WPARAM)-1,0);
  2609.     
  2610. }
  2611.  
  2612. /*******************************************************************/
  2613.  
  2614.  
  2615. void CMessageDlg::OnRecipLB()
  2616. {
  2617.     DWORD   dwReturn    = 0;
  2618.  
  2619.     dwReturn = SendDlgItemMessage(IDC_PROPS,        LB_SETCURSEL,(WPARAM)-1,0);
  2620.     dwReturn = SendDlgItemMessage(IDC_MSGATTACH,    LB_SETCURSEL,(WPARAM)-1,0);
  2621. }
  2622.  
  2623. /*******************************************************************/
  2624.  
  2625. void CMessageDlg::OnProperty()
  2626. {
  2627.     DWORD   dwReturn = 0;
  2628.  
  2629.     dwReturn = SendDlgItemMessage(IDC_MSGRECIPIENTS,LB_SETCURSEL,(WPARAM)-1,0);
  2630.     dwReturn = SendDlgItemMessage(IDC_MSGATTACH,    LB_SETCURSEL,(WPARAM)-1,0);
  2631. }
  2632.  
  2633.  
  2634. /*******************************************************************/
  2635. /*********************** MsgSpecial **************************/
  2636.  
  2637. /********************************************************************/
  2638. /*
  2639.  -  CMsgSpecialDlg::
  2640.  -  OnInitDialog
  2641.  -
  2642.  *  Purpose:
  2643.  *
  2644.  */
  2645. /********************************************************************/
  2646.  
  2647. BOOL CMsgSpecialDlg::OnInitDialog()
  2648. {
  2649.     CGetError       E;
  2650.     DWORD           dwReturn            = 0;
  2651.     HRESULT         hResult             = hrSuccess;
  2652.     char            szBuffer[300];
  2653.     ULONG           cVals               = 0;
  2654.     LPSPropValue    lpspva              = NULL;
  2655.     ULONG           i;
  2656.  
  2657.   
  2658.     SizedSPropTagArray(7,sptaMsgSpecial) =
  2659.     {
  2660.         7,
  2661.         {
  2662.             PR_SUBJECT,
  2663.             PR_MESSAGE_CLASS,
  2664.             PR_OBJECT_TYPE,
  2665.             PR_ACCESS,
  2666.             PR_ACCESS_LEVEL,
  2667.             PR_HASATTACH,
  2668.             PR_MESSAGE_FLAGS,
  2669.         }
  2670.     };
  2671.  
  2672.  
  2673.  
  2674.     hResult = m_lpMessage->GetProps((LPSPropTagArray)&sptaMsgSpecial,0,&cVals,&lpspva);
  2675.     if( HR_FAILED(hResult) )
  2676.     {
  2677.         MessageBox( E.SzError("lpMDB->GetProps(sptaMsgSpecial)", hResult),
  2678.                  "Client", MBS_ERROR );
  2679.         return FALSE;
  2680.     }
  2681.  
  2682.     i = 0;
  2683.  
  2684.     // PR_SUBJECT
  2685.     if(lpspva[i].ulPropTag != PR_SUBJECT )
  2686.     {
  2687.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2688.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2689.         else
  2690.             wsprintf(szBuffer,"PR_SUBJECT not available");
  2691.     }
  2692.     else
  2693.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  2694.     SetDlgItemText(IDT_SUBJECT1,szBuffer);
  2695.     i++;
  2696.  
  2697.     // PR_MESSAGE_CLASS
  2698.     if(lpspva[i].ulPropTag != PR_MESSAGE_CLASS )
  2699.     {
  2700.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2701.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2702.         else
  2703.             wsprintf(szBuffer,"PR_MESSAGE_CLASS not available");
  2704.     }
  2705.     else
  2706.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  2707.     SetDlgItemText(IDT_MESSAGE_CLASS1,szBuffer);
  2708.     i++;
  2709.  
  2710.     // PR_OBJECT_TYPE
  2711.     if(lpspva[i].ulPropTag != PR_OBJECT_TYPE )
  2712.     {
  2713.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2714.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2715.         else
  2716.             wsprintf(szBuffer,"PR_OBJECT_TYPE not available");
  2717.     }
  2718.     else
  2719.         GetString( "MAPIObjTypes", lpspva[i].Value.ul, szBuffer );
  2720.     SetDlgItemText(IDT_OBJECT_TYPE1,szBuffer);
  2721.     i++;
  2722.  
  2723.  
  2724.     // PR_ACCESS
  2725.     if(lpspva[i].ulPropTag != PR_ACCESS )
  2726.     {
  2727.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2728.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2729.         else
  2730.             wsprintf(szBuffer,"PR_ACCESS not available");
  2731.         SetDlgItemText(IDT_ACCESS1,szBuffer);
  2732.     }
  2733.     else
  2734.     {
  2735.         if( (lpspva[i].Value.ul & MAPI_ACCESS_MODIFY) )
  2736.             SetDlgItemText(IDT_ACCESS1,"MAPI_ACCESS_MODIFY");
  2737.             
  2738.         if( (lpspva[i].Value.ul & MAPI_ACCESS_READ) )
  2739.             SetDlgItemText(IDT_ACCESS2,"MAPI_ACCESS_READ");
  2740.             
  2741.         if( (lpspva[i].Value.ul & MAPI_ACCESS_DELETE) )
  2742.             SetDlgItemText(IDT_ACCESS3,"MAPI_ACCESS_DELETE");
  2743.             
  2744.         if( (lpspva[i].Value.ul & MAPI_ACCESS_CREATE_HIERARCHY) )        
  2745.             SetDlgItemText(IDT_ACCESS4,"MAPI_ACCESS_CREATE_HIERARCHY");
  2746.             
  2747.         if( (lpspva[i].Value.ul & MAPI_ACCESS_CREATE_CONTENTS) )
  2748.             SetDlgItemText(IDT_ACCESS5,"MAPI_ACCESS_CREATE_CONTENTS");
  2749.             
  2750.         if( (lpspva[i].Value.ul & MAPI_ACCESS_CREATE_ASSOCIATED) )
  2751.             SetDlgItemText(IDT_ACCESS6,"MAPI_ACCESS_CREATE_ASSOCIATED");
  2752.     }
  2753.     i++;
  2754.  
  2755.     // PR_ACCESS_LEVEL
  2756.     if(lpspva[i].ulPropTag != PR_ACCESS_LEVEL )
  2757.     {
  2758.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2759.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2760.         else
  2761.             wsprintf(szBuffer,"PR_ACCESS_LEVEL not available");
  2762.     }
  2763.     else
  2764.     {
  2765.         if(lpspva[i].Value.ul == MAPI_MODIFY )
  2766.             wsprintf(szBuffer,"MAPI_MODIFY");
  2767.         else
  2768.             wsprintf(szBuffer,"Read Only");
  2769.     }            
  2770.     SetDlgItemText(IDT_ACCESS_LEVEL1,szBuffer);
  2771.     i++;
  2772.  
  2773.     // PR_HASATTACH
  2774.     if(lpspva[i].ulPropTag != PR_HASATTACH )
  2775.     {
  2776.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2777.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2778.         else
  2779.             wsprintf(szBuffer,"PR_HASATTACH not available");
  2780.     }
  2781.     else
  2782.     {
  2783.         if(lpspva[i].Value.b == TRUE )
  2784.             wsprintf(szBuffer,"YES");
  2785.         else
  2786.             wsprintf(szBuffer,"NO");
  2787.     }            
  2788.     SetDlgItemText(IDT_HASATTACH1,szBuffer);
  2789.     i++;
  2790.  
  2791.  
  2792.     // PR_MESSAGE_FLAGS
  2793.     if(lpspva[i].ulPropTag != PR_MESSAGE_FLAGS )
  2794.     {
  2795.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2796.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2797.         else
  2798.             wsprintf(szBuffer,"PR_MESSAGE_FLAGS not available");
  2799.         SetDlgItemText(IDT_MESSAGE_FLAGS1,szBuffer);
  2800.     }
  2801.     else
  2802.     {
  2803.         if( (lpspva[i].Value.ul & MSGFLAG_READ) )
  2804.             SetDlgItemText(IDT_MESSAGE_FLAGS1,"MSGFLAG_READ");
  2805.  
  2806.         if( (lpspva[i].Value.ul & MSGFLAG_UNMODIFIED) )
  2807.             SetDlgItemText(IDT_MESSAGE_FLAGS2,"MSGFLAG_UNMODIFIED");
  2808.  
  2809.         if( (lpspva[i].Value.ul & MSGFLAG_SUBMIT) )
  2810.             SetDlgItemText(IDT_MESSAGE_FLAGS3,"MSGFLAG_SUBMIT");
  2811.  
  2812.         if( (lpspva[i].Value.ul & MSGFLAG_UNSENT) )
  2813.             SetDlgItemText(IDT_MESSAGE_FLAGS4,"MSGFLAG_UNSENT");
  2814.  
  2815.         if( (lpspva[i].Value.ul & MSGFLAG_HASATTACH) )
  2816.             SetDlgItemText(IDT_MESSAGE_FLAGS5,"MSGFLAG_HASATTACH");
  2817.  
  2818.         if( (lpspva[i].Value.ul & MSGFLAG_FROMME) )
  2819.             SetDlgItemText(IDT_MESSAGE_FLAGS6,"MSGFLAG_FROMME");
  2820.  
  2821.         if( (lpspva[i].Value.ul & MSGFLAG_ASSOCIATED) )
  2822.             SetDlgItemText(IDT_MESSAGE_FLAGS7,"MSGFLAG_ASSOCIATED");
  2823.  
  2824.         if( (lpspva[i].Value.ul & MSGFLAG_RESEND) )
  2825.             SetDlgItemText(IDT_MESSAGE_FLAGS8,"MSGFLAG_RESEND");
  2826.     }
  2827.     i++;
  2828.  
  2829.     MAPIFreeBuffer(lpspva);
  2830.  
  2831.     return TRUE;
  2832. }
  2833.  
  2834.  
  2835. /*******************************************************************/
  2836. /*
  2837.  -  CMsgSpecialDlg::
  2838.  -  ~CMsgSpecialDlg
  2839.  -
  2840.  *  Purpose:
  2841.  *      Destructor for class CMsgSpecialDlg. Releases and Frees memory
  2842.  *      allocated in this class
  2843.  *
  2844.  */
  2845. /*******************************************************************/
  2846.  
  2847. CMsgSpecialDlg::~CMsgSpecialDlg()
  2848. {
  2849.  
  2850. }
  2851.  
  2852.  
  2853. /*******************************************************************/
  2854. /*
  2855.  -  CMsgSpecialDlg::
  2856.  -  OnCancel
  2857.  -
  2858.  *  Purpose:
  2859.  *
  2860.  */
  2861. /*******************************************************************/
  2862.  
  2863. void CMsgSpecialDlg::OnCancel()
  2864. {
  2865.     EndDialog(IDCANCEL);
  2866. }
  2867.  
  2868.           
  2869.         
  2870.  
  2871.  
  2872. /*******************************************************************/
  2873. /*********************** IPMSpecial **************************/
  2874.  
  2875. /********************************************************************/
  2876. /*
  2877.  -  CIPMSpecialDlg::
  2878.  -  OnInitDialog
  2879.  -
  2880.  *  Purpose:
  2881.  *
  2882.  */
  2883. /********************************************************************/
  2884.  
  2885. BOOL CIPMSpecialDlg::OnInitDialog()
  2886. {
  2887.     CGetError       E;
  2888.     DWORD           dwReturn            = 0;
  2889.     HRESULT         hResult             = hrSuccess;
  2890.     char            szBuffer[300];
  2891.     ULONG           cVals               = 0;
  2892.     LPSPropValue    lpspva              = NULL;
  2893.     ULONG           i;
  2894.  
  2895.   
  2896.     SizedSPropTagArray(10,sptaIPMSpecial) =
  2897.     {
  2898.         10,
  2899.         {
  2900.             PR_SUBJECT,
  2901.             PR_MESSAGE_CLASS,
  2902.             PR_AUTO_FORWARDED,
  2903.             PR_IMPORTANCE,
  2904.             PR_INCOMPLETE_COPY,
  2905.             PR_SENSITIVITY,
  2906.             PR_SEARCH_KEY,
  2907.             PR_EXPIRY_TIME,
  2908.             PR_PRIORITY,
  2909.             PR_READ_RECEIPT_REQUESTED,
  2910.         }
  2911.     };
  2912.  
  2913.  
  2914.  
  2915.     hResult = m_lpMessage->GetProps((LPSPropTagArray)&sptaIPMSpecial,0,&cVals,&lpspva);
  2916.     if( HR_FAILED(hResult) )
  2917.     {
  2918.         MessageBox( E.SzError("lpMDB->GetProps(sptaIPMSpecial)", hResult),
  2919.                  "Client", MBS_ERROR );
  2920.         return FALSE;
  2921.     }
  2922.  
  2923.     i = 0;
  2924.  
  2925.     // PR_SUBJECT
  2926.     if(lpspva[i].ulPropTag != PR_SUBJECT )
  2927.     {
  2928.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2929.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2930.         else
  2931.             wsprintf(szBuffer,"PR_SUBJECT not available");
  2932.     }
  2933.     else
  2934.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  2935.     SetDlgItemText(IDT_SUBJECT1,szBuffer);
  2936.     i++;
  2937.  
  2938.     // PR_MESSAGE_CLASS
  2939.     if(lpspva[i].ulPropTag != PR_MESSAGE_CLASS )
  2940.     {
  2941.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2942.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2943.         else
  2944.             wsprintf(szBuffer,"PR_MESSAGE_CLASS not available");
  2945.     }
  2946.     else
  2947.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  2948.     SetDlgItemText(IDT_MESSAGE_CLASS1,szBuffer);
  2949.     i++;
  2950.  
  2951.     // PR_AUTO_FORWARDED
  2952.     if(lpspva[i].ulPropTag != PR_AUTO_FORWARDED )
  2953.     {
  2954.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2955.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2956.         else
  2957.             wsprintf(szBuffer,"PR_AUTO_FORWARDED not available");
  2958.     }
  2959.     else
  2960.     {
  2961.         if(lpspva[i].Value.b == TRUE )
  2962.             wsprintf(szBuffer,"YES");
  2963.         else
  2964.             wsprintf(szBuffer,"NO");
  2965.     }            
  2966.     SetDlgItemText(IDT_AUTO_FORWARDED1,szBuffer);
  2967.     i++;
  2968.  
  2969.  
  2970.     // PR_IMPORTANCE
  2971.     if(lpspva[i].ulPropTag != PR_IMPORTANCE )
  2972.     {
  2973.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2974.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  2975.         else
  2976.             wsprintf(szBuffer,"PR_IMPORTANCE not available");
  2977.         SetDlgItemText(IDT_IMPORTANCE1,szBuffer);
  2978.     }
  2979.     else
  2980.     {
  2981.         if( (lpspva[i].Value.ul == IMPORTANCE_LOW) )
  2982.             SetDlgItemText(IDT_IMPORTANCE1,"IMPORTANCE_LOW");
  2983.         else if( (lpspva[i].Value.ul == IMPORTANCE_NORMAL) )
  2984.             SetDlgItemText(IDT_IMPORTANCE1,"IMPORTANCE_NORMAL");
  2985.         else if( (lpspva[i].Value.ul == IMPORTANCE_HIGH) )
  2986.             SetDlgItemText(IDT_IMPORTANCE1,"IMPORTANCE_HIGH");
  2987.         else
  2988.         {
  2989.             wsprintf(szBuffer,"PR_IMPORTANCE = %lu, Unknown !",lpspva[i].Value.ul);
  2990.             SetDlgItemText(IDT_IMPORTANCE1,szBuffer);
  2991.         }
  2992.     }
  2993.     i++;
  2994.  
  2995.     // PR_INCOMPLETE_COPY
  2996.     if(lpspva[i].ulPropTag != PR_INCOMPLETE_COPY )
  2997.     {
  2998.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  2999.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3000.         else
  3001.             wsprintf(szBuffer,"PR_INCOMPLETE_COPY not available");
  3002.     }
  3003.     else
  3004.     {
  3005.         if(lpspva[i].Value.b == TRUE )
  3006.             wsprintf(szBuffer,"YES");
  3007.         else
  3008.             wsprintf(szBuffer,"NO");
  3009.     }            
  3010.     SetDlgItemText(IDT_INCOMPLETE_COPY1,szBuffer);
  3011.     i++;
  3012.  
  3013.  
  3014.     // PR_SENSITIVITY
  3015.     if(lpspva[i].ulPropTag != PR_SENSITIVITY )
  3016.     {
  3017.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3018.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3019.         else
  3020.             wsprintf(szBuffer,"PR_SENSITIVITY not available");
  3021.         SetDlgItemText(IDT_SENSITIVITY1,szBuffer);
  3022.     }
  3023.     else
  3024.     {
  3025.         if( (lpspva[i].Value.ul == SENSITIVITY_NONE) )
  3026.             SetDlgItemText(IDT_SENSITIVITY1,"SENSITIVITY_NONE");
  3027.         else if( (lpspva[i].Value.ul == SENSITIVITY_PERSONAL) )
  3028.             SetDlgItemText(IDT_SENSITIVITY1,"SENSITIVITY_PERSONAL");
  3029.         else if( (lpspva[i].Value.ul == SENSITIVITY_PRIVATE) )
  3030.             SetDlgItemText(IDT_SENSITIVITY1,"SENSITIVITY_PRIVATE");
  3031.         else if( (lpspva[i].Value.ul == SENSITIVITY_COMPANY_CONFIDENTIAL) )
  3032.             SetDlgItemText(IDT_SENSITIVITY1,"SENSITIVITY_COMPANY_CONFIDENTIAL");
  3033.         else
  3034.         {
  3035.             wsprintf(szBuffer,"PR_SENSITIVITY = %lu, Unknown !",lpspva[i].Value.ul);
  3036.             SetDlgItemText(IDT_SENSITIVITY1,szBuffer);
  3037.         }
  3038.     }
  3039.     i++;
  3040.  
  3041.     // PR_SEARCH_KEY
  3042.     if(lpspva[i].ulPropTag != PR_SEARCH_KEY )
  3043.     {
  3044.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3045.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3046.         else
  3047.             wsprintf(szBuffer,"PR_SEARCH_KEY not available");
  3048.     }
  3049.     else
  3050.     {
  3051.         szBuffer[0] = '\0';
  3052.         
  3053.         char    lpszHex[9];
  3054.         ULONG   cb = 0;
  3055.         LPBYTE  lpb = lpspva[i].Value.bin.lpb;
  3056.         ULONG   cChars = 0;
  3057.  
  3058.         while((cb < lpspva[i].Value.bin.cb) && (cChars < 40 ) )
  3059.         {
  3060.             wsprintf(lpszHex, "%02X ", *lpb);
  3061.             lstrcat(szBuffer, lpszHex);
  3062.             cChars += 3;
  3063.             lpb++;
  3064.             cb++;
  3065.         }
  3066.  
  3067.         if( ((lpspva[i].Value.bin.cb)*3) > 40 )
  3068.         {
  3069.             lstrcat(szBuffer, " }etc");
  3070.         }
  3071.     }
  3072.     SetDlgItemText(IDT_SEARCH_KEY1,szBuffer);
  3073.     i++;
  3074.  
  3075.  
  3076.     // PR_EXPIRY_TIME  
  3077.     if(lpspva[i].ulPropTag != PR_EXPIRY_TIME )
  3078.     {
  3079.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3080.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3081.         else
  3082.             wsprintf(szBuffer,"PR_EXPIRY_TIME not available");
  3083.         SetDlgItemText(IDT_EXPIRY_TIME1,szBuffer);
  3084.     }
  3085.     else
  3086.     {
  3087.         SzGetPropValue(szBuffer, (LPSPropValue) &(lpspva[i]) );
  3088.         SetDlgItemText(IDT_EXPIRY_TIME1,szBuffer);
  3089.     }
  3090.     i++;
  3091.  
  3092.  
  3093.     // PR_PRIORITY
  3094.     if(lpspva[i].ulPropTag != PR_PRIORITY )
  3095.     {
  3096.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3097.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3098.         else
  3099.             wsprintf(szBuffer,"PR_PRIORITY not available");
  3100.         SetDlgItemText(IDT_PRIORITY1,szBuffer);
  3101.     }
  3102.     else
  3103.     {
  3104.         if( (lpspva[i].Value.ul == PRIO_URGENT) )
  3105.             SetDlgItemText(IDT_PRIORITY1,"PRIO_URGENT");
  3106.         else if( (lpspva[i].Value.ul == PRIO_NORMAL) )
  3107.             SetDlgItemText(IDT_PRIORITY1,"PRIO_NORMAL");
  3108.         else if( (lpspva[i].Value.ul == PRIO_NONURGENT) )
  3109.             SetDlgItemText(IDT_PRIORITY1,"PRIO_NONURGENT");
  3110.         else
  3111.         {
  3112.             wsprintf(szBuffer,"PR_PRIORITY = %lu, Unknown !",lpspva[i].Value.ul);
  3113.             SetDlgItemText(IDT_PRIORITY1,szBuffer);
  3114.         }
  3115.     }
  3116.     i++;
  3117.  
  3118.     // PR_READ_RECEIPT_REQUESTED
  3119.     if(lpspva[i].ulPropTag != PR_READ_RECEIPT_REQUESTED )
  3120.     {
  3121.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3122.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3123.         else
  3124.             wsprintf(szBuffer,"PR_READ_RECEIPT_REQUESTED not available");
  3125.     }
  3126.     else
  3127.     {
  3128.         if(lpspva[i].Value.b == TRUE )
  3129.             wsprintf(szBuffer,"YES");
  3130.         else
  3131.             wsprintf(szBuffer,"NO");
  3132.     }            
  3133.     SetDlgItemText(IDT_READ_RECEIPT_REQUESTED1,szBuffer);
  3134.     i++;
  3135.  
  3136.  
  3137.     MAPIFreeBuffer(lpspva);
  3138.  
  3139.     return TRUE;
  3140. }
  3141.  
  3142.  
  3143. /*******************************************************************/
  3144. /*
  3145.  -  CIPMSpecialDlg::
  3146.  -  ~CIPMSpecialDlg
  3147.  -
  3148.  *  Purpose:
  3149.  *      Destructor for class CIPMSpecialDlg. Releases and Frees memory
  3150.  *      allocated in this class
  3151.  *
  3152.  */
  3153. /*******************************************************************/
  3154.  
  3155. CIPMSpecialDlg::~CIPMSpecialDlg()
  3156. {
  3157.  
  3158. }
  3159.  
  3160.  
  3161. /*******************************************************************/
  3162. /*
  3163.  -  CIPMSpecialDlg::
  3164.  -  OnCancel
  3165.  -
  3166.  *  Purpose:
  3167.  *
  3168.  */
  3169. /*******************************************************************/
  3170.  
  3171. void CIPMSpecialDlg::OnCancel()
  3172. {
  3173.     EndDialog(IDCANCEL);
  3174. }
  3175.  
  3176. /*******************************************************************/
  3177. /*********************** IPNSpecial **************************/
  3178.  
  3179. /********************************************************************/
  3180. /*
  3181.  -  CIPNSpecialDlg::
  3182.  -  OnInitDialog
  3183.  -
  3184.  *  Purpose:
  3185.  *
  3186.  */
  3187. /********************************************************************/
  3188.  
  3189. BOOL CIPNSpecialDlg::OnInitDialog()
  3190. {
  3191.     CGetError       E;
  3192.     DWORD           dwReturn            = 0;
  3193.     HRESULT         hResult             = hrSuccess;
  3194.     char            szBuffer[300];
  3195.     ULONG           cVals               = 0;
  3196.     LPSPropValue    lpspva              = NULL;
  3197.     ULONG           i;
  3198.  
  3199.   
  3200.     SizedSPropTagArray(15,sptaIPNSpecial) =
  3201.     {
  3202.         15,
  3203.         {
  3204.             PR_SUBJECT,
  3205.             PR_MESSAGE_CLASS,
  3206.             PR_ORIGINAL_SEARCH_KEY,
  3207.             PR_CONVERSION_EITS,
  3208.             PR_ORIGINALLY_INTENDED_RECIPIENT_NAME,
  3209.             PR_SENDER_NAME,
  3210.             PR_SENDER_EMAIL_ADDRESS,
  3211.             PR_SENDER_ADDRTYPE,
  3212.             PR_REPORT_TEXT,
  3213.             PR_REPORT_TIME,
  3214.             PR_RECEIPT_TIME,
  3215.             PR_ACKNOWLEDGEMENT_MODE,
  3216.             PR_AUTO_FORWARD_COMMENT,
  3217.             PR_DISCARD_REASON,
  3218.             PR_NON_RECEIPT_REASON,
  3219.        }
  3220.     };
  3221.  
  3222.     hResult = m_lpMessage->GetProps((LPSPropTagArray)&sptaIPNSpecial,0,&cVals,&lpspva);
  3223.     if( HR_FAILED(hResult) )
  3224.     {
  3225.         MessageBox( E.SzError("lpMDB->GetProps(sptaIPNSpecial)", hResult),
  3226.                  "Client", MBS_ERROR );
  3227.         return FALSE;
  3228.     }
  3229.  
  3230.     i = 0;
  3231.  
  3232.     // PR_SUBJECT
  3233.     if(lpspva[i].ulPropTag != PR_SUBJECT )
  3234.     {
  3235.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3236.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3237.         else
  3238.             wsprintf(szBuffer,"PR_SUBJECT not available");
  3239.     }
  3240.     else
  3241.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  3242.     SetDlgItemText(IDT_SUBJECT1,szBuffer);
  3243.     i++;
  3244.  
  3245.     // PR_MESSAGE_CLASS
  3246.     if(lpspva[i].ulPropTag != PR_MESSAGE_CLASS )
  3247.     {
  3248.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3249.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3250.         else
  3251.             wsprintf(szBuffer,"PR_MESSAGE_CLASS not available");
  3252.     }
  3253.     else
  3254.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  3255.     SetDlgItemText(IDT_MESSAGE_CLASS1,szBuffer);
  3256.     i++;
  3257.  
  3258.     // PR_ORIGINAL_SEARCH_KEY
  3259.     if(lpspva[i].ulPropTag != PR_ORIGINAL_SEARCH_KEY )
  3260.     {
  3261.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3262.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3263.         else
  3264.             wsprintf(szBuffer,"PR_ORIGINAL_SEARCH_KEY not available");
  3265.     }
  3266.     else
  3267.     {
  3268.         szBuffer[0] = '\0';
  3269.         
  3270.         char    lpszHex[9];
  3271.         ULONG   cb = 0;
  3272.         LPBYTE  lpb = lpspva[i].Value.bin.lpb;
  3273.         ULONG   cChars = 0;
  3274.  
  3275.         while((cb < lpspva[i].Value.bin.cb) && (cChars < 40 ) )
  3276.         {
  3277.             wsprintf(lpszHex, "%02X ", *lpb);
  3278.             lstrcat(szBuffer, lpszHex);
  3279.             cChars += 3;
  3280.             lpb++;
  3281.             cb++;
  3282.         }
  3283.  
  3284.         if( ((lpspva[i].Value.bin.cb)*3) > 40 )
  3285.         {
  3286.             lstrcat(szBuffer, " }etc");
  3287.         }
  3288.     }
  3289.     SetDlgItemText(IDT_ORIGINAL_SEARCH_KEY1,szBuffer);
  3290.     i++;
  3291.  
  3292.     // PR_CONVERSION_EITS
  3293.     if(lpspva[i].ulPropTag != PR_CONVERSION_EITS )
  3294.     {
  3295.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3296.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3297.         else
  3298.             wsprintf(szBuffer,"PR_CONVERSION_EITS not available");
  3299.     }
  3300.     else
  3301.     {
  3302.         szBuffer[0] = '\0';
  3303.         
  3304.         char    lpszHex[9];
  3305.         ULONG   cb = 0;
  3306.         LPBYTE  lpb = lpspva[i].Value.bin.lpb;
  3307.         ULONG   cChars = 0;
  3308.  
  3309.         while((cb < lpspva[i].Value.bin.cb) && (cChars < 40 ) )
  3310.         {
  3311.             wsprintf(lpszHex, "%02X ", *lpb);
  3312.             lstrcat(szBuffer, lpszHex);
  3313.             cChars += 3;
  3314.             lpb++;
  3315.             cb++;
  3316.         }
  3317.  
  3318.         if( ((lpspva[i].Value.bin.cb)*3) > 40 )
  3319.         {
  3320.             lstrcat(szBuffer, " }etc");
  3321.         }
  3322.     }
  3323.     SetDlgItemText(IDT_CONVERSION_EITS1,szBuffer);
  3324.     i++;
  3325.  
  3326.     // PR_ORIGINALLY_INTENDED_RECIPIENT_NAME
  3327.     if(lpspva[i].ulPropTag != PR_ORIGINALLY_INTENDED_RECIPIENT_NAME )
  3328.     {
  3329.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3330.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3331.         else
  3332.             wsprintf(szBuffer,"PR_ORIGINALLY_INTENDED_RECIPIENT_NAME not available");
  3333.     }
  3334.     else
  3335.     {
  3336.         szBuffer[0] = '\0';
  3337.         
  3338.         char    lpszHex[9];
  3339.         ULONG   cb = 0;
  3340.         LPBYTE  lpb = lpspva[i].Value.bin.lpb;
  3341.         ULONG   cChars = 0;
  3342.  
  3343.         while((cb < lpspva[i].Value.bin.cb) && (cChars < 40 ) )
  3344.         {
  3345.             wsprintf(lpszHex, "%02X ", *lpb);
  3346.             lstrcat(szBuffer, lpszHex);
  3347.             cChars += 3;
  3348.             lpb++;
  3349.             cb++;
  3350.         }
  3351.  
  3352.         if( ((lpspva[i].Value.bin.cb)*3) > 40 )
  3353.         {
  3354.             lstrcat(szBuffer, " }etc");
  3355.         }
  3356.     }
  3357.     SetDlgItemText(IDT_ORIGINALLY_INTENDED_RECIPIENT_NAME1,szBuffer);
  3358.     i++;
  3359.  
  3360.     // PR_SENDER_NAME
  3361.     if(lpspva[i].ulPropTag != PR_SENDER_NAME )
  3362.     {
  3363.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3364.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3365.         else
  3366.             wsprintf(szBuffer,"PR_SENDER_NAME not available");
  3367.     }
  3368.     else
  3369.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  3370.     SetDlgItemText(IDT_SENDER_NAME1,szBuffer);
  3371.     i++;
  3372.  
  3373.     // PR_SENDER_EMAIL_ADDRESS
  3374.     if(lpspva[i].ulPropTag != PR_SENDER_EMAIL_ADDRESS )
  3375.     {
  3376.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3377.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3378.         else
  3379.             wsprintf(szBuffer,"PR_SENDER_EMAIL_ADDRESS not available");
  3380.     }
  3381.     else
  3382.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  3383.     SetDlgItemText(IDT_SENDER_EMAIL_ADDRESS1,szBuffer);
  3384.     i++;
  3385.  
  3386.     // PR_SENDER_ADDRTYPE
  3387.     if(lpspva[i].ulPropTag != PR_SENDER_ADDRTYPE )
  3388.     {
  3389.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3390.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3391.         else
  3392.             wsprintf(szBuffer,"PR_SENDER_ADDRTYPE not available");
  3393.     }
  3394.     else
  3395.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  3396.     SetDlgItemText(IDT_SENDER_ADDRTYPE1,szBuffer);
  3397.     i++;
  3398.  
  3399.     // PR_REPORT_TEXT
  3400.     if(lpspva[i].ulPropTag != PR_REPORT_TEXT )
  3401.     {
  3402.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3403.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3404.         else
  3405.             wsprintf(szBuffer,"PR_REPORT_TEXT not available");
  3406.     }
  3407.     else
  3408.         wsprintf(szBuffer,lpspva[i].Value.lpszA);
  3409.     SetDlgItemText(IDT_REPORT_TEXT1,szBuffer);
  3410.     i++;
  3411.  
  3412.     // PR_REPORT_TIME  
  3413.     if(lpspva[i].ulPropTag != PR_REPORT_TIME )
  3414.     {
  3415.         if( PROP_TYPE(lpspva[i].ulPropTag) == PT_ERROR)
  3416.             GetString( "MAPIErrors", lpspva[i].Value.err, szBuffer );
  3417.         else
  3418.             wsprintf(szBuffer,"PR_REPORT_TIME not available");
  3419.         SetDlgItemText(IDT_REPORT_TIME1,szBuffer);
  3420.     }
  3421.     else
  3422.     {
  3423.         SzGetPropValue(szBuffer, (LPSPropValue) &(lpspva[i]) );
  3424.         SetDlgItemText(IDT_REPORT_TIME1,szBuffer);
  3425.     }
  3426.     i++;
  3427.  
  3428.     // Depending on whether it is a NRN or an RN, we have different
  3429.     // required properties, and therefore display different props
  3430.  
  3431.     // NOTE NOTE NOTE, Order of the lpspva is important for these values !!!
  3432.  
  3433.     if( !_stricmp(lpspva[1].Value.lpszA,"REPORT.IPM.Note.IPNRN" ) )
  3434.     {
  3435.         // Receipt Notification Props
  3436.         //   PR_ACKNOWLEDGEMENT_MODE
  3437.         //   PR_RECEIPT_TIME
  3438.  
  3439.         // 1.  Fill in Name
  3440.  
  3441.         SetDlgItemText(IDT_RECEIPT_TIME,        "PR_RECEIPT_TIME");
  3442.         SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE, "PR_ACKNOWLEDGEMENT_MODE");
  3443.         SetDlgItemText(IDT_AUTO_FORWARD_COMMENT," ");
  3444.  
  3445.         // 2.  Fill in Data
  3446.  
  3447.         // PR_RECEIPT_TIME  
  3448.         if(lpspva[10].ulPropTag != PR_RECEIPT_TIME )
  3449.         {
  3450.             if( PROP_TYPE(lpspva[10].ulPropTag) == PT_ERROR)
  3451.                 GetString( "MAPIErrors", lpspva[10].Value.err, szBuffer );
  3452.             else
  3453.                 wsprintf(szBuffer,"PR_RECEIPT_TIME not available");
  3454.             SetDlgItemText(IDT_RECEIPT_TIME1,szBuffer);
  3455.         }
  3456.         else
  3457.         {
  3458.             SzGetPropValue(szBuffer, (LPSPropValue) &(lpspva[10]) );
  3459.             SetDlgItemText(IDT_RECEIPT_TIME1,szBuffer);
  3460.         }
  3461.  
  3462.         // PR_ACKNOWLEDGEMENT_MODE
  3463.         if(lpspva[11].ulPropTag != PR_ACKNOWLEDGEMENT_MODE )
  3464.         {
  3465.             if( PROP_TYPE(lpspva[11].ulPropTag) == PT_ERROR)
  3466.                 GetString( "MAPIErrors", lpspva[11].Value.err, szBuffer );
  3467.             else
  3468.                 wsprintf(szBuffer,"PR_ACKNOWLEDGEMENT_MODE not available");
  3469.             SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,szBuffer);
  3470.         }
  3471.         else
  3472.         {
  3473.             if( (lpspva[11].Value.ul == 0) )
  3474.                 SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,"IM_MANUAL");
  3475.             else if( (lpspva[11].Value.ul == 1) )
  3476.                 SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,"IM_AUTOMATIC");
  3477.             else
  3478.             {
  3479.                 wsprintf(szBuffer,"PR_ACKNOWLEDGEMENT_MODE = %lu, Unknown !",lpspva[11].Value.ul);
  3480.                 SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,szBuffer);
  3481.             }
  3482.         }
  3483.     }        
  3484.     else if( !_stricmp(lpspva[1].Value.lpszA,"REPORT.IPM.Note.IPNNRN" ) )
  3485.     {
  3486.         // Non Receipt Notification Props
  3487.         //   PR_DISCARD_REASON
  3488.         //   PR_NON_RECEIPT_REASON
  3489.         //   PR_AUTO_FORWARD_COMMENT
  3490.  
  3491.         // 1.  Fill in Name
  3492.  
  3493.         SetDlgItemText(IDT_RECEIPT_TIME,        "PR_DISCARD_REASON");
  3494.         SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE, "PR_NON_RECEIPT_REASON");
  3495.         SetDlgItemText(IDT_AUTO_FORWARD_COMMENT,"PR_AUTO_FORWARD_COMMENT");
  3496.  
  3497.         // 2.  Fill in Data
  3498.         
  3499.         // PR_DISCARD_REASON
  3500.         if(lpspva[13].ulPropTag != PR_DISCARD_REASON )
  3501.         {
  3502.             if( PROP_TYPE(lpspva[13].ulPropTag) == PT_ERROR)
  3503.                 GetString( "MAPIErrors", lpspva[13].Value.err, szBuffer );
  3504.             else
  3505.                 wsprintf(szBuffer,"PR_DISCARD_REASON not available");
  3506.             SetDlgItemText(IDT_RECEIPT_TIME1,szBuffer);
  3507.         }
  3508.         else
  3509.         {
  3510.             if( (lpspva[13].Value.ul == -1) )
  3511.                 SetDlgItemText(IDT_RECEIPT_TIME1,"IM_NO_DISCARD");
  3512.             else if( (lpspva[13].Value.ul == 0) )
  3513.                 SetDlgItemText(IDT_RECEIPT_TIME1,"IM_IPM_EXPIRED");
  3514.             else if( (lpspva[13].Value.ul == 1) )
  3515.                 SetDlgItemText(IDT_RECEIPT_TIME1,"IM_IPM_OBSOLETED");
  3516.             else if( (lpspva[13].Value.ul == 2) )
  3517.                 SetDlgItemText(IDT_RECEIPT_TIME1,"IM_IPM_TERMINATED");
  3518.             else
  3519.             {
  3520.                 wsprintf(szBuffer,"PR_DISCARD_REASON = %lu, Unknown !",lpspva[13].Value.ul);
  3521.                 SetDlgItemText(IDT_RECEIPT_TIME1,szBuffer);
  3522.             }
  3523.         }
  3524.                 
  3525.         // PR_NON_RECEIPT_REASON
  3526.         if(lpspva[14].ulPropTag != PR_NON_RECEIPT_REASON )
  3527.         {
  3528.             if( PROP_TYPE(lpspva[14].ulPropTag) == PT_ERROR)
  3529.                 GetString( "MAPIErrors", lpspva[14].Value.err, szBuffer );
  3530.             else
  3531.                 wsprintf(szBuffer,"PR_NON_RECEIPT_REASON not available");
  3532.             SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,szBuffer);
  3533.         }
  3534.         else
  3535.         {
  3536.             if( (lpspva[14].Value.ul == 0) )
  3537.                 SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,"IM_IPM_DISCARDED");
  3538.             else if( (lpspva[14].Value.ul == 1) )
  3539.                 SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,"IM_IPM_AUTO_FORWARDED");
  3540.             else
  3541.             {
  3542.                 wsprintf(szBuffer,"PR_NON_RECEIPT_REASON = %lu, Unknown !",lpspva[14].Value.ul);
  3543.                 SetDlgItemText(IDT_ACKNOWLEGEMENT_MODE1,szBuffer);
  3544.             }
  3545.         }
  3546.         
  3547.         // PR_AUTO_FORWARD_COMMENT
  3548.         if(lpspva[12].ulPropTag != PR_AUTO_FORWARD_COMMENT )
  3549.         {
  3550.             if( PROP_TYPE(lpspva[12].ulPropTag) == PT_ERROR)
  3551.                 GetString( "MAPIErrors", lpspva[12].Value.err, szBuffer );
  3552.             else
  3553.                 wsprintf(szBuffer,"PR_AUTO_FORWARD_COMMENT not available");
  3554.         }
  3555.         else
  3556.             wsprintf(szBuffer,lpspva[12].Value.lpszA);
  3557.         SetDlgItemText(IDT_AUTO_FORWARD_COMMENT1,szBuffer);
  3558.         
  3559.  
  3560.     }        
  3561.     
  3562.  
  3563.  
  3564.     MAPIFreeBuffer(lpspva);
  3565.  
  3566.     return TRUE;
  3567. }
  3568.  
  3569.  
  3570. /*******************************************************************/
  3571. /*
  3572.  -  CIPNSpecialDlg::
  3573.  -  ~CIPNSpecialDlg
  3574.  -
  3575.  *  Purpose:
  3576.  *      Destructor for class CIPNSpecialDlg. Releases and Frees memory
  3577.  *      allocated in this class
  3578.  *
  3579.  */
  3580. /*******************************************************************/
  3581.  
  3582. CIPNSpecialDlg::~CIPNSpecialDlg()
  3583. {
  3584.  
  3585. }
  3586.  
  3587.  
  3588. /*******************************************************************/
  3589. /*
  3590.  -  CIPNSpecialDlg::
  3591.  -  OnCancel
  3592.  -
  3593.  *  Purpose:
  3594.  *
  3595.  */
  3596. /*******************************************************************/
  3597.  
  3598. void CIPNSpecialDlg::OnCancel()
  3599. {
  3600.     EndDialog(IDCANCEL);
  3601. }
  3602.