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

  1. /*******************************************************************/
  2. /*
  3.  -  Results.cpp
  4.  -  Copyright (C) 1995 Microsoft Corporation
  5.  -
  6.  *  Purpose:
  7.  *      Contains member functions for CResultsDlg
  8.  */
  9. /*******************************************************************/
  10.                                                    
  11. #undef  CINTERFACE      // C++ calling convention for mapi calls
  12.  
  13. #ifdef WIN32
  14. #ifdef _WIN95
  15. #define _INC_OLE
  16. #endif
  17. #define INC_OLE2
  18. #define INC_RPC
  19. #endif
  20.  
  21. #include <afxwin.h>     
  22. #include <windowsx.h>
  23. #include <string.h>
  24.  
  25. #ifdef WIN16
  26. #include <compobj.h>
  27. #endif
  28.  
  29. #ifdef WIN32
  30. #include <objbase.h>
  31. #include <objerror.h>
  32. #ifdef _WIN95
  33. #include <ole2.h>
  34. #endif
  35. #endif
  36.  
  37.  
  38. #ifdef WIN16
  39. #include <mapiwin.h>    
  40. #endif
  41. #include <mapix.h>      
  42. #include <strtbl.h>     
  43. #include <misctool.h>
  44. #include "resource.h"   
  45. #include "propvu.h"  
  46. #include "results.h"
  47.  
  48. /*******************************************************************/
  49. /**************************** GETPROPS *****************************/
  50.  
  51. /******************* Set Property Message Map *********************/
  52.  
  53. BEGIN_MESSAGE_MAP(CResultsDlg, CModalDialog)
  54.  
  55.     ON_COMMAND(         IDC_RES_DUMP_BEFORE,     OnDumpPropValsBeforeToFile)
  56.     ON_COMMAND(         IDC_RES_DUMP_AFTER,      OnDumpPropValsAfterToFile)
  57.     ON_COMMAND(         IDC_RES_DUMP_PROBLEMS,   OnDumpProblemsToFile)
  58.     ON_COMMAND(         IDC_RES_DUMP_MODIFY,     OnDumpPropsModifyToFile)
  59.     ON_LBN_DBLCLK(      IDC_RES_MOD,             OnSelectMod )
  60.     ON_LBN_DBLCLK(      IDC_RES_BEFORE,          OnSelectBefore )
  61.     ON_LBN_DBLCLK(      IDC_RES_AFTER,           OnSelectAfter )
  62.     ON_LBN_DBLCLK(      IDC_RES_PROBLEMS,        OnSelectProblem )
  63.                  
  64. END_MESSAGE_MAP()
  65.  
  66. /********************************************************************/
  67. /*
  68.  -  CResultsDlg::
  69.  -  OnInitDialog
  70.  -
  71.  *  Purpose:
  72.  *
  73.  */
  74. /********************************************************************/
  75.  
  76. BOOL CResultsDlg::OnInitDialog()
  77. {       
  78.     int             rgTabStops[4];
  79.     DWORD           dwReturn        = 0;      
  80.  
  81.     SetWindowText( m_Operation.GetBuffer(40) );
  82.  
  83.     SendDlgItemMessage(IDC_RES_BEFORE,      LB_RESETCONTENT,0,0);
  84.     SendDlgItemMessage(IDC_RES_AFTER,       LB_RESETCONTENT,0,0);
  85.     SendDlgItemMessage(IDC_RES_MOD,      LB_RESETCONTENT,0,0);
  86.     SendDlgItemMessage(IDC_RES_PROBLEMS,    LB_RESETCONTENT,0,0);
  87.  
  88.  
  89.     if( (!m_lpspvaBefore) || (!m_lpspvaAfter) || (!m_cValuesBefore) || (!m_cValuesAfter))
  90.     {
  91.         MessageBox( "CResultsDlg::OnInitDialog  (!m_lpspvaBefore) || (!m_lpspvaAfter) || (!m_cValuesBefore) || (!m_cValuesAfter) ",
  92.                     "Client", MBS_ERROR );
  93.         goto error;
  94.     }           
  95.     
  96.     // set tab stops for all listboxes
  97.     rgTabStops[0] = PROBLEM_LISTBOX_TAB1_SIZE ;
  98.     rgTabStops[1] = PROBLEM_LISTBOX_TAB2_SIZE ;
  99.  
  100.     dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS, LB_SETHORIZONTALEXTENT,
  101.                     (WPARAM) PROP_LISTBOX_HORIZONTAL_SIZE ,0 );
  102.  
  103.     dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,LB_SETTABSTOPS,
  104.                     (WPARAM) 2,(LPARAM)rgTabStops );
  105.  
  106.     rgTabStops[0] = PROP_LISTBOX_TAB1_SIZE ;
  107.     rgTabStops[1] = PROP_LISTBOX_TAB2_SIZE ;
  108.  
  109.     dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,LB_SETHORIZONTALEXTENT,
  110.                     (WPARAM) PROP_LISTBOX_HORIZONTAL_SIZE ,0 );
  111.  
  112.     dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,LB_SETTABSTOPS,
  113.                     (WPARAM) 2,(LPARAM)rgTabStops );
  114.  
  115.     dwReturn = SendDlgItemMessage(IDC_RES_AFTER,LB_SETHORIZONTALEXTENT,
  116.                     (WPARAM) PROP_LISTBOX_HORIZONTAL_SIZE ,0 );
  117.  
  118.     dwReturn = SendDlgItemMessage(IDC_RES_AFTER,LB_SETTABSTOPS,
  119.                     (WPARAM) 2,(LPARAM)rgTabStops );
  120.  
  121.     dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETHORIZONTALEXTENT,
  122.                     (WPARAM) PROP_LISTBOX_HORIZONTAL_SIZE ,0 );
  123.  
  124.     dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETTABSTOPS,
  125.                     (WPARAM) 2,(LPARAM)rgTabStops );
  126.         
  127.     DisplayAll();
  128.  
  129.     return TRUE;    
  130.  
  131. error:
  132.  
  133.     if(m_lpspvaBefore)
  134.     {
  135.         MAPIFreeBuffer(m_lpspvaBefore);
  136.         m_lpspvaBefore          = NULL;
  137.         m_cValuesBefore         = 0;
  138.     }
  139.     
  140.     if(m_lpspvaAfter)
  141.     {
  142.         MAPIFreeBuffer(m_lpspvaAfter);
  143.         m_lpspvaAfter           = NULL;
  144.         m_cValuesAfter          = 0;
  145.     }
  146.     
  147.     return FALSE;
  148. }
  149.  
  150.  
  151. /********************************************************************/
  152. /*
  153.  -  CResultsDlg::
  154.  -  OnSelectMod
  155.  -
  156.  *  Purpose:
  157.  *
  158.  */
  159. /********************************************************************/
  160.  
  161. void CResultsDlg::OnSelectMod()
  162. {       
  163.     LONG                lSelection      = -1;
  164.     ULONG               ulSelectedTag   = 0;
  165.     ULONG               idx;
  166.     DWORD               dwReturn        = 0;
  167.     
  168.  
  169.     // get selected item from modify listbox
  170.     lSelection = SendDlgItemMessage(IDC_RES_MOD,LB_GETCURSEL,0,0 );
  171.     if(lSelection == LB_ERR)
  172.         return;
  173.  
  174.     if(m_fIsPropValueArray) 
  175.     {           
  176.         ulSelectedTag = m_lpspvaModify[lSelection].ulPropTag;
  177.     }
  178.     else
  179.     {
  180.         ulSelectedTag = m_lpsptaModify->aulPropTag[lSelection];            
  181.     }        
  182.         
  183.     // find the same proptag in other listboxes(After,Before,Problem)
  184.     //   and set cursor selection on other corresponding items or set 
  185.     //   cursor selection on nothing if it is not in other listboxes.
  186.  
  187.     // BEFORE
  188.     for(idx = 0 ; idx < m_cValuesBefore; idx++)
  189.     {
  190.         if( m_lpspvaBefore[idx].ulPropTag == ulSelectedTag )            
  191.         {
  192.             dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,LB_SETCURSEL,(WPARAM) idx ,0 );
  193.             break;
  194.         }
  195.     }
  196.     // if couldn't find the proptag, set cursor selection to nothing
  197.     if(idx == m_cValuesBefore)
  198.         dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,    LB_SETCURSEL,(WPARAM) -1 , 0 );
  199.  
  200.     // AFTER
  201.     for(idx = 0 ; idx < m_cValuesAfter; idx++)
  202.     {
  203.         if( m_lpspvaAfter[idx].ulPropTag == ulSelectedTag )            
  204.         {
  205.             dwReturn = SendDlgItemMessage(IDC_RES_AFTER, LB_SETCURSEL,(WPARAM) idx, 0 );
  206.             break;
  207.         }
  208.     }                                                                                
  209.     // if couldn't find the proptag, set cursor selection to nothing
  210.     if(idx == m_cValuesAfter)
  211.         dwReturn = SendDlgItemMessage(IDC_RES_AFTER,     LB_SETCURSEL,(WPARAM) -1,  0 );
  212.  
  213.     // PROBLEMS
  214.     if(m_lpProblems)
  215.     {
  216.         for(idx = 0 ; idx < m_lpProblems->cProblem; idx++)
  217.         {
  218.             if( m_lpProblems->aProblem[idx].ulPropTag == ulSelectedTag )            
  219.             {
  220.                 dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,    LB_SETCURSEL,(WPARAM) idx ,0 );
  221.                 break;
  222.             }
  223.         }
  224.         // if couldn't find the proptag, set cursor selection to nothing
  225.         if(idx == m_lpProblems->cProblem)
  226.             dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,        LB_SETCURSEL,(WPARAM) -1 ,0 );
  227.     }
  228. }
  229. /********************************************************************/
  230. /*
  231.  -  CResultsDlg::
  232.  -  OnSelectBefore
  233.  -
  234.  *  Purpose:
  235.  *
  236.  */
  237. /********************************************************************/
  238.  
  239. void CResultsDlg::OnSelectBefore()
  240. {       
  241.     LONG                lSelection      = -1;
  242.     ULONG               ulSelectedTag   = 0;
  243.     ULONG               idx;
  244.     DWORD               dwReturn        = 0;
  245.     
  246.     
  247.     // get selected item from modify listbox
  248.     lSelection = SendDlgItemMessage(IDC_RES_BEFORE,LB_GETCURSEL,0,0 );
  249.     if(lSelection == LB_ERR)
  250.         return;
  251.             
  252.     ulSelectedTag = m_lpspvaBefore[lSelection].ulPropTag;
  253.         
  254.         
  255.     // find the same proptag in other listboxes(After,Before,Problem)
  256.     //   and set cursor selection on other corresponding items or set 
  257.     //   cursor selection on nothing if it is not in other listboxes.
  258.  
  259.     // MODIFY
  260.     if(m_fIsPropValueArray) 
  261.     {           
  262.  
  263.         for(idx = 0 ; idx < m_cValuesModify; idx++)
  264.         {
  265.             if( m_lpspvaModify[idx].ulPropTag == ulSelectedTag )            
  266.             {
  267.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETCURSEL,(WPARAM) idx ,0 );
  268.                 break;
  269.             }
  270.         }
  271.         // if couldn't find the proptag, set cursor selection to nothing
  272.         if(idx == m_cValuesModify)
  273.             dwReturn = SendDlgItemMessage(IDC_RES_MOD,    LB_SETCURSEL,(WPARAM) -1 , 0 );
  274.     }
  275.     else
  276.     {
  277.         for(idx = 0 ; idx < m_lpsptaModify->cValues; idx++)
  278.         {
  279.             if( m_lpsptaModify->aulPropTag[idx] == ulSelectedTag )            
  280.             {
  281.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETCURSEL,(WPARAM) idx ,0 );
  282.                 break;
  283.             }
  284.         }
  285.         // if couldn't find the proptag, set cursor selection to nothing
  286.         if(idx == m_lpsptaModify->cValues)
  287.             dwReturn = SendDlgItemMessage(IDC_RES_MOD,    LB_SETCURSEL,(WPARAM) -1 , 0 );        
  288.     }
  289.  
  290.     // AFTER
  291.     for(idx = 0 ; idx < m_cValuesAfter; idx++)
  292.     {
  293.         if( m_lpspvaAfter[idx].ulPropTag == ulSelectedTag )            
  294.         {
  295.             dwReturn = SendDlgItemMessage(IDC_RES_AFTER, LB_SETCURSEL,(WPARAM) idx, 0 );
  296.             break;
  297.         }
  298.     }                                                                                
  299.     // if couldn't find the proptag, set cursor selection to nothing
  300.     if(idx == m_cValuesAfter)
  301.         dwReturn = SendDlgItemMessage(IDC_RES_AFTER,     LB_SETCURSEL,(WPARAM) -1,  0 );
  302.  
  303.     // PROBLEMS
  304.     if(m_lpProblems)
  305.     {
  306.         for(idx = 0 ; idx < m_lpProblems->cProblem; idx++)
  307.         {
  308.             if( m_lpProblems->aProblem[idx].ulPropTag == ulSelectedTag )            
  309.             {
  310.                 dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,    LB_SETCURSEL,(WPARAM) idx ,0 );
  311.                 break;
  312.             }
  313.         }
  314.         // if couldn't find the proptag, set cursor selection to nothing
  315.         if(idx == m_lpProblems->cProblem)
  316.             dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,        LB_SETCURSEL,(WPARAM) -1 ,0 );
  317.     }
  318. }
  319. /********************************************************************/
  320. /*
  321.  -  CResultsDlg::
  322.  -  OnSelectAfter
  323.  -
  324.  *  Purpose:
  325.  *
  326.  */
  327. /********************************************************************/
  328.  
  329. void CResultsDlg::OnSelectAfter()
  330. {       
  331.     LONG                lSelection      = -1;
  332.     ULONG               ulSelectedTag   = 0;
  333.     ULONG               idx;
  334.     DWORD               dwReturn        = 0;
  335.     
  336.     
  337.     // get selected item from modify listbox
  338.     lSelection = SendDlgItemMessage(IDC_RES_AFTER,LB_GETCURSEL,0,0 );
  339.     if(lSelection == LB_ERR)
  340.         return;
  341.             
  342.     ulSelectedTag = m_lpspvaAfter[lSelection].ulPropTag;
  343.         
  344.         
  345.     // find the same proptag in other listboxes(After,Before,Problem)
  346.     //   and set cursor selection on other corresponding items or set 
  347.     //   cursor selection on nothing if it is not in other listboxes.
  348.  
  349.     // MODIFY
  350.     if(m_fIsPropValueArray) 
  351.     {           
  352.  
  353.         for(idx = 0 ; idx < m_cValuesModify; idx++)
  354.         {
  355.             if( m_lpspvaModify[idx].ulPropTag == ulSelectedTag )            
  356.             {
  357.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETCURSEL,(WPARAM) idx ,0 );
  358.                 break;
  359.             }
  360.         }
  361.         // if couldn't find the proptag, set cursor selection to nothing
  362.         if(idx == m_cValuesModify)
  363.             dwReturn = SendDlgItemMessage(IDC_RES_MOD,    LB_SETCURSEL,(WPARAM) -1 , 0 );
  364.     }
  365.     else
  366.     {
  367.         for(idx = 0 ; idx < m_lpsptaModify->cValues; idx++)
  368.         {
  369.             if( m_lpsptaModify->aulPropTag[idx] == ulSelectedTag )            
  370.             {
  371.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETCURSEL,(WPARAM) idx ,0 );
  372.                 break;
  373.             }
  374.         }
  375.         // if couldn't find the proptag, set cursor selection to nothing
  376.         if(idx == m_lpsptaModify->cValues)
  377.             dwReturn = SendDlgItemMessage(IDC_RES_MOD,    LB_SETCURSEL,(WPARAM) -1 , 0 );        
  378.     }
  379.  
  380.     // BEFORE
  381.     for(idx = 0 ; idx < m_cValuesBefore; idx++)
  382.     {
  383.         if( m_lpspvaBefore[idx].ulPropTag == ulSelectedTag )            
  384.         {
  385.             dwReturn = SendDlgItemMessage(IDC_RES_BEFORE, LB_SETCURSEL,(WPARAM) idx, 0 );
  386.             break;
  387.         }
  388.     }                                                                                
  389.     // if couldn't find the proptag, set cursor selection to nothing
  390.     if(idx == m_cValuesBefore)
  391.         dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,     LB_SETCURSEL,(WPARAM) -1,  0 );
  392.  
  393.     // PROBLEMS
  394.     if(m_lpProblems)
  395.     {
  396.         for(idx = 0 ; idx < m_lpProblems->cProblem; idx++)
  397.         {
  398.             if( m_lpProblems->aProblem[idx].ulPropTag == ulSelectedTag )            
  399.             {
  400.                 dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,    LB_SETCURSEL,(WPARAM) idx ,0 );
  401.                 break;
  402.             }
  403.         }
  404.         // if couldn't find the proptag, set cursor selection to nothing
  405.         if(idx == m_lpProblems->cProblem)
  406.             dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,        LB_SETCURSEL,(WPARAM) -1 ,0 );
  407.     }
  408. }
  409.  
  410. /********************************************************************/
  411. /*
  412.  -  CResultsDlg::
  413.  -  OnSelectBefore
  414.  -
  415.  *  Purpose:
  416.  *
  417.  */
  418. /********************************************************************/
  419.  
  420. void CResultsDlg::OnSelectProblem()
  421. {       
  422.     LONG                lSelection      = -1;
  423.     ULONG               ulSelectedTag   = 0;
  424.     ULONG               idx;
  425.     DWORD               dwReturn        = 0;
  426.     
  427.     
  428.     // get selected item from modify listbox
  429.     lSelection = SendDlgItemMessage(IDC_RES_PROBLEMS,LB_GETCURSEL,0,0 );
  430.     if(lSelection == LB_ERR)
  431.         return;
  432.             
  433.     if(!m_lpProblems)
  434.         return;
  435.                     
  436.     ulSelectedTag = m_lpProblems->aProblem[lSelection].ulPropTag;
  437.         
  438.         
  439.     // find the same proptag in other listboxes(After,Before,Problem)
  440.     //   and set cursor selection on other corresponding items or set 
  441.     //   cursor selection on nothing if it is not in other listboxes.
  442.  
  443.     // MODIFY
  444.     if(m_fIsPropValueArray) 
  445.     {           
  446.  
  447.         for(idx = 0 ; idx < m_cValuesModify; idx++)
  448.         {
  449.             if( m_lpspvaModify[idx].ulPropTag == ulSelectedTag )            
  450.             {
  451.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETCURSEL,(WPARAM) idx ,0 );
  452.                 break;
  453.             }
  454.         }
  455.         // if couldn't find the proptag, set cursor selection to nothing
  456.         if(idx == m_cValuesModify)
  457.             dwReturn = SendDlgItemMessage(IDC_RES_MOD,    LB_SETCURSEL,(WPARAM) -1 , 0 );
  458.     }
  459.     else
  460.     {
  461.         for(idx = 0 ; idx < m_lpsptaModify->cValues; idx++)
  462.         {
  463.             if( m_lpsptaModify->aulPropTag[idx] == ulSelectedTag )            
  464.             {
  465.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_SETCURSEL,(WPARAM) idx ,0 );
  466.                 break;
  467.             }
  468.         }
  469.         // if couldn't find the proptag, set cursor selection to nothing
  470.         if(idx == m_lpsptaModify->cValues)
  471.             dwReturn = SendDlgItemMessage(IDC_RES_MOD,    LB_SETCURSEL,(WPARAM) -1 , 0 );        
  472.     }
  473.     // BEFORE
  474.     for(idx = 0 ; idx < m_cValuesBefore; idx++)
  475.     {
  476.         if( m_lpspvaBefore[idx].ulPropTag == ulSelectedTag )            
  477.         {
  478.             dwReturn = SendDlgItemMessage(IDC_RES_BEFORE, LB_SETCURSEL,(WPARAM) idx, 0 );
  479.             break;
  480.         }
  481.     }                                                                                
  482.     // if couldn't find the proptag, set cursor selection to nothing
  483.     if(idx == m_cValuesBefore)
  484.         dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,     LB_SETCURSEL,(WPARAM) -1,  0 );
  485.  
  486.     // AFTER
  487.     for(idx = 0 ; idx < m_cValuesAfter; idx++)
  488.     {
  489.         if( m_lpspvaAfter[idx].ulPropTag == ulSelectedTag )            
  490.         {
  491.             dwReturn = SendDlgItemMessage(IDC_RES_AFTER, LB_SETCURSEL,(WPARAM) idx, 0 );
  492.             break;
  493.         }
  494.     }                                                                                
  495.     // if couldn't find the proptag, set cursor selection to nothing
  496.     if(idx == m_cValuesAfter)
  497.         dwReturn = SendDlgItemMessage(IDC_RES_AFTER,     LB_SETCURSEL,(WPARAM) -1,  0 );
  498.  
  499. }
  500.  
  501. /*******************************************************************/
  502. /*
  503.  -  CBldPropDlg::
  504.  -  DisplayAll
  505.  *
  506.  *  Purpose:
  507.  *
  508.  *  Parameters:
  509.  *
  510.  *  Returns:
  511.  *
  512.  */
  513. /*******************************************************************/
  514.  
  515. void CResultsDlg::DisplayAll()
  516. {
  517.     char            szBuffer[1024];
  518.     int             idx             = 0;
  519.     DWORD           dwReturn        = 0;      
  520.     char            szCValues[30];
  521.     char            szID[50];
  522.     char            szData[512];
  523.     char            szType[32];      // Assumes no PropType string longer than 31 chars
  524.     char            szIndex[10];
  525.     char            szPropTag[50];
  526.     char            szScError[50];      
  527.  
  528.     // multi value props stuff    
  529.     char            szMV[1024];    
  530.     char            szMVSeps[]      = ";:.";
  531.     char            *lpszToken      = NULL;
  532.     char            szTemp[30];
  533.     ULONG           ulMVRow         = 0;
  534.     ULONG           ulMVcValues     = 0;
  535.     char            *szEnd          = NULL;
  536.  
  537.  
  538.     SendDlgItemMessage(IDC_RES_PROBLEMS,LB_RESETCONTENT,0,0);
  539.     SendDlgItemMessage(IDC_RES_BEFORE,  LB_RESETCONTENT,0,0);
  540.     SendDlgItemMessage(IDC_RES_AFTER,   LB_RESETCONTENT,0,0);
  541.     SendDlgItemMessage(IDC_RES_MOD,     LB_RESETCONTENT,0,0);
  542.  
  543.  
  544.     // DISPLAY MODIFY PTA OR PVA
  545.     if(m_fIsPropValueArray) 
  546.     {           
  547.             
  548.         for(idx = 0; idx < m_cValuesModify; idx++)
  549.         {   
  550.             szID[0]     = '\0' ;
  551.             szData[0]   = '\0' ;
  552.             szType[0]   = '\0' ;
  553.             szBuffer[0] = '\0' ;
  554.                 
  555.             if(GetString("PropIDs", PROP_ID( m_lpspvaModify[idx].ulPropTag), szID ) )
  556.             {
  557.                 lstrcat(szBuffer, szID );               
  558.                 lstrcat(szBuffer, "\t");
  559.             }
  560.             else
  561.             {
  562.                 wsprintf(szBuffer,"%#04X\t", PROP_ID(  m_lpspvaModify[idx].ulPropTag) );        
  563.             }
  564.  
  565.             if( GetString("PropType", PROP_TYPE( m_lpspvaModify[idx].ulPropTag), szType) )
  566.             {
  567.                 lstrcat(szBuffer, szType);
  568.                 lstrcat(szBuffer,"\t");
  569.             }       
  570.             else
  571.             {
  572.                 wsprintf(szType,"%#04X\t", PROP_TYPE( m_lpspvaModify[idx].ulPropTag) );
  573.                 lstrcat(szBuffer,szType);
  574.             }
  575.  
  576.             SzGetPropValue(szData,(LPSPropValue) &m_lpspvaModify[idx]);
  577.  
  578.             // if it is a MultiValueProperty, parse the output, and add
  579.             //   more than one row for this property
  580.             if( (PROP_TYPE(m_lpspvaModify[idx].ulPropTag)) & MV_FLAG )
  581.             {
  582.                 // it is multi value, so strtok out the data 
  583.                 // and add a row for each data value                                                        
  584.                 ulMVRow = 0;
  585.  
  586.                 // determine number of cValues
  587.                 lpszToken   = strtok(szData,szMVSeps);
  588.                 ulMVcValues = strtoul(lpszToken,&szEnd,16);        
  589.  
  590.                 // rip out first row of multi value prop
  591.                 lpszToken = strtok(NULL,szMVSeps);
  592.                                 
  593.                 // rip out remaining rows                
  594.                 while( lpszToken != NULL )
  595.                 {
  596.                     lstrcpy(szMV,szBuffer);
  597.                     wsprintf(szTemp,"[%lu] ",ulMVRow);
  598.                     lstrcat(szMV,szTemp);
  599.                     lstrcat(szMV,lpszToken);
  600.                 
  601.                     dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_ADDSTRING,0,
  602.                             (LPARAM)szMV);
  603.                 
  604.                     lpszToken = strtok(NULL,szMVSeps);
  605.                     ulMVRow++;
  606.                 }                
  607.                 
  608.                 // if all the data was not there, fill in the remainder with bogus stub
  609.                 while( ulMVRow < ulMVcValues )
  610.                 {
  611.                     lstrcpy(szMV,szBuffer);
  612.                     wsprintf(szTemp,"[%lu] ",ulMVRow);
  613.                     lstrcat(szMV,szTemp);
  614.                     lstrcat(szMV,"<No Data Available>");
  615.                 
  616.                     dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_ADDSTRING,0,
  617.                             (LPARAM)szMV);
  618.                     ulMVRow++;                            
  619.                 }
  620.             }
  621.             else            
  622.             {
  623.                 lstrcat(szBuffer,szData);
  624.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_ADDSTRING,0,
  625.                             (LPARAM)szBuffer);
  626.             }
  627.  
  628.         
  629.         }  // end of for loop of m_cValuesModify in lpNewPropValue
  630.  
  631.         wsprintf(szCValues,"cValues:  %lu",m_cValuesModify);
  632.         SetDlgItemText(IDT_RES_MOD_CVALS,szCValues);       
  633.  
  634.     }
  635.     else  // it is a proptag array
  636.     {
  637.         if(m_lpsptaModify)      // for CopyTo(), this may be null
  638.         {            
  639.             for(idx = 0; idx < m_lpsptaModify->cValues; idx++)
  640.             {   
  641.                 szID[0]     = '\0' ;
  642.                 szType[0]   = '\0' ;
  643.                 szBuffer[0] = '\0' ;
  644.                     
  645.                 if(GetString("PropIDs", PROP_ID(m_lpsptaModify->aulPropTag[idx]), szID ) )
  646.                 {
  647.                     lstrcat(szBuffer, szID );               
  648.                     lstrcat(szBuffer, "\t");
  649.                 }
  650.                 else
  651.                 {
  652.                     wsprintf(szBuffer,"%#04X\t", PROP_ID(m_lpsptaModify->aulPropTag[idx]) );        
  653.                 }
  654.  
  655.                 if( GetString("PropType", PROP_TYPE(m_lpsptaModify->aulPropTag[idx]), szType) )
  656.                 {
  657.                     lstrcat(szBuffer, szType);
  658.                     lstrcat(szBuffer,"\t");
  659.                 }       
  660.                 else
  661.                 {
  662.                     wsprintf(szType,"%#04X\t", PROP_TYPE(m_lpsptaModify->aulPropTag[idx]) );
  663.                     lstrcat(szBuffer,szType);
  664.                 }
  665.                 dwReturn = SendDlgItemMessage(IDC_RES_MOD,LB_ADDSTRING,0,
  666.                                     (LPARAM)szBuffer);
  667.             
  668.  
  669.             }  
  670.             wsprintf(szCValues,"lpspta->cValues:  %lu",m_lpsptaModify->cValues);
  671.             SetDlgItemText(IDT_RES_MOD_CVALS,szCValues);       
  672.         }
  673.     }             
  674.     
  675.     // BEFORE DISPLAY       
  676.     wsprintf(szCValues,"cValues:  %lu",m_cValuesBefore);
  677.     SetDlgItemText(IDT_RES_BEFORE_CVALS,szCValues);
  678.     szBuffer[0] = '\0' ;
  679.         
  680.     for(idx = 0; idx < m_cValuesBefore; idx++)
  681.     {   
  682.         szID[0]     = '\0' ;
  683.         szData[0]   = '\0' ;
  684.         szType[0]   = '\0' ;
  685.         szBuffer[0] = '\0' ;
  686.             
  687.         if(GetString("PropIDs", PROP_ID(m_lpspvaBefore[idx].ulPropTag), szID ) )
  688.         {
  689.             lstrcat(szBuffer, szID );               
  690.             lstrcat(szBuffer, "\t");
  691.         }
  692.         else
  693.         {
  694.             wsprintf(szBuffer,"%#04X\t", PROP_ID(m_lpspvaBefore[idx].ulPropTag) );      
  695.         }
  696.  
  697.         if( GetString("PropType", PROP_TYPE(m_lpspvaBefore[idx].ulPropTag), szType) )
  698.         {
  699.             lstrcat(szBuffer, szType);
  700.             lstrcat(szBuffer,"\t");
  701.         }       
  702.         else
  703.         {
  704.             wsprintf(szType,"%#04X\t", PROP_TYPE(m_lpspvaBefore[idx].ulPropTag) );
  705.             lstrcat(szBuffer,szType);
  706.         }
  707.         
  708.         SzGetPropValue(szData,(LPSPropValue) &m_lpspvaBefore[idx]);
  709.  
  710.         // if it is a MultiValueProperty, parse the output, and add
  711.         //   more than one row for this property
  712.         if( (PROP_TYPE(m_lpspvaBefore[idx].ulPropTag)) & MV_FLAG )
  713.         {
  714.             // it is multi value, so strtok out the data 
  715.             // and add a row for each data value                                                        
  716.             ulMVRow = 0;
  717.  
  718.             // determine number of cValues
  719.             lpszToken   = strtok(szData,szMVSeps);
  720.             ulMVcValues = strtoul(lpszToken,&szEnd,16);        
  721.  
  722.             // rip out first row of multi value prop
  723.             lpszToken = strtok(NULL,szMVSeps);
  724.                             
  725.             // rip out remaining rows                
  726.             while( lpszToken != NULL )
  727.             {
  728.                 lstrcpy(szMV,szBuffer);
  729.                 wsprintf(szTemp,"[%lu] ",ulMVRow);
  730.                 lstrcat(szMV,szTemp);
  731.                 lstrcat(szMV,lpszToken);
  732.             
  733.                 dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,LB_ADDSTRING,0,
  734.                         (LPARAM)szMV);
  735.             
  736.                 lpszToken = strtok(NULL,szMVSeps);
  737.                 ulMVRow++;
  738.             }                
  739.             
  740.             // if all the data was not there, fill in the remainder with bogus stub
  741.             while( ulMVRow < ulMVcValues )
  742.             {
  743.                 lstrcpy(szMV,szBuffer);
  744.                 wsprintf(szTemp,"[%lu] ",ulMVRow);
  745.                 lstrcat(szMV,szTemp);
  746.                 lstrcat(szMV,"<No Data Available>");
  747.             
  748.                 dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,LB_ADDSTRING,0,
  749.                         (LPARAM)szMV);
  750.                 ulMVRow++;                            
  751.             }
  752.         }
  753.         else            
  754.         {
  755.             lstrcat(szBuffer,szData);
  756.             dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,LB_ADDSTRING,0,
  757.                         (LPARAM)szBuffer);
  758.         }
  759.     
  760.     } 
  761.  
  762.     // AFTER DISPLAY
  763.     wsprintf(szCValues,"cValues:  %lu",m_cValuesAfter);
  764.     SetDlgItemText(IDT_RES_AFTER_CVALS,szCValues);
  765.     szBuffer[0] = '\0' ;
  766.  
  767.     for(idx = 0; idx < m_cValuesAfter; idx++)
  768.     {   
  769.         szID[0]     = '\0' ;
  770.         szData[0]   = '\0' ;
  771.         szType[0]   = '\0' ;
  772.         szBuffer[0] = '\0' ;
  773.             
  774.         if(GetString("PropIDs", PROP_ID(m_lpspvaAfter[idx].ulPropTag), szID ) )
  775.         {
  776.             lstrcat(szBuffer, szID );               
  777.             lstrcat(szBuffer, "\t");
  778.         }
  779.         else
  780.         {
  781.             wsprintf(szBuffer,"%#04X\t", PROP_ID(m_lpspvaAfter[idx].ulPropTag) );       
  782.         }
  783.  
  784.         if( GetString("PropType", PROP_TYPE(m_lpspvaAfter[idx].ulPropTag), szType) )
  785.         {
  786.             lstrcat(szBuffer, szType);
  787.             lstrcat(szBuffer,"\t");
  788.         }       
  789.         else
  790.         {
  791.             wsprintf(szType,"%#04X\t", PROP_TYPE(m_lpspvaAfter[idx].ulPropTag) );
  792.             lstrcat(szBuffer,szType);
  793.         }
  794.  
  795.         SzGetPropValue(szData,(LPSPropValue) &m_lpspvaAfter[idx]);
  796.  
  797.         // if it is a MultiValueProperty, parse the output, and add
  798.         //   more than one row for this property
  799.         if( (PROP_TYPE(m_lpspvaAfter[idx].ulPropTag)) & MV_FLAG )
  800.         {
  801.             // it is multi value, so strtok out the data 
  802.             // and add a row for each data value                                                        
  803.             ulMVRow = 0;
  804.  
  805.             // determine number of cValues
  806.             lpszToken   = strtok(szData,szMVSeps);
  807.             ulMVcValues = strtoul(lpszToken,&szEnd,16);        
  808.  
  809.             // rip out first row of multi value prop
  810.             lpszToken = strtok(NULL,szMVSeps);
  811.                             
  812.             // rip out remaining rows                
  813.             while( lpszToken != NULL )
  814.             {
  815.                 lstrcpy(szMV,szBuffer);
  816.                 wsprintf(szTemp,"[%lu] ",ulMVRow);
  817.                 lstrcat(szMV,szTemp);
  818.                 lstrcat(szMV,lpszToken);
  819.             
  820.                 dwReturn = SendDlgItemMessage(IDC_RES_AFTER,LB_ADDSTRING,0,
  821.                         (LPARAM)szMV);
  822.             
  823.                 lpszToken = strtok(NULL,szMVSeps);
  824.                 ulMVRow++;
  825.             }                
  826.             
  827.             // if all the data was not there, fill in the remainder with bogus stub
  828.             while( ulMVRow < ulMVcValues )
  829.             {
  830.                 lstrcpy(szMV,szBuffer);
  831.                 wsprintf(szTemp,"[%lu] ",ulMVRow);
  832.                 lstrcat(szMV,szTemp);
  833.                 lstrcat(szMV,"<No Data Available>");
  834.             
  835.                 dwReturn = SendDlgItemMessage(IDC_RES_AFTER,LB_ADDSTRING,0,
  836.                         (LPARAM)szMV);
  837.                 ulMVRow++;                            
  838.             }
  839.         }
  840.         else            
  841.         {
  842.             lstrcat(szBuffer,szData);
  843.             dwReturn = SendDlgItemMessage(IDC_RES_AFTER,LB_ADDSTRING,0,
  844.                         (LPARAM)szBuffer);
  845.         }
  846.  
  847.     } 
  848.  
  849.     // DISPLAY PROBLEMS(if any)
  850.     if(m_lpProblems)
  851.     {
  852.         wsprintf(szCValues,"cProblems:  %lu",m_lpProblems->cProblem);
  853.         SetDlgItemText(IDT_RES_PROBLEMS_CVALS,szCValues);
  854.  
  855.         szBuffer[0] = '\0' ;
  856.  
  857.  
  858.         // DISPLAY ALL PROBLEMS         
  859.         for(idx = 0; idx < m_lpProblems->cProblem; idx++)
  860.         {   
  861.             szIndex[0]      = '\0' ;
  862.             szPropTag[0]    = '\0' ;
  863.             szScError[0]    = '\0' ;
  864.                 
  865.  
  866.             wsprintf(szBuffer,"%lu",m_lpProblems->aProblem[idx].ulIndex);
  867.             lstrcat(szBuffer, "\t");
  868.  
  869.  
  870.             if(GetString("PropTags", m_lpProblems->aProblem[idx].ulPropTag, szPropTag ) )
  871.             {
  872.                 lstrcat(szBuffer, szPropTag );              
  873.                 lstrcat(szBuffer, "\t");
  874.             }
  875.             else
  876.             {
  877.                 wsprintf(szPropTag,"%#04X\t", m_lpProblems->aProblem[idx].ulPropTag );      
  878.                 lstrcat(szBuffer,szPropTag);
  879.             }
  880.  
  881.             if( GetString("MAPIErrors", m_lpProblems->aProblem[idx].scode, szScError) )
  882.             {
  883.                 lstrcat(szBuffer, szScError);
  884.                 lstrcat(szBuffer,"\t");
  885.             }       
  886.             else
  887.             {
  888.                 wsprintf(szScError,"%#04X\t",  m_lpProblems->aProblem[idx].scode );
  889.                 lstrcat(szBuffer,szScError);
  890.             }
  891.             dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS,LB_ADDSTRING,0,
  892.                                 (LPARAM)szBuffer);      
  893.         }  
  894.     }
  895.  
  896.     // set focus/cursor selection off all listboxes
  897.     dwReturn = SendDlgItemMessage(IDC_RES_AFTER,    LB_SETCURSEL,(WPARAM) -1 ,0 );
  898.     dwReturn = SendDlgItemMessage(IDC_RES_BEFORE,   LB_SETCURSEL,(WPARAM) -1 ,0 );
  899.     dwReturn = SendDlgItemMessage(IDC_RES_PROBLEMS, LB_SETCURSEL,(WPARAM) -1 ,0 );
  900.     dwReturn = SendDlgItemMessage(IDC_RES_MOD,   LB_SETCURSEL,(WPARAM) -1 ,0 );
  901. }
  902.  
  903.  
  904. /*******************************************************************/
  905. /*
  906.  -  CResultsDlg::
  907.  -  ~CResultsDlg
  908.  -
  909.  *  Purpose:
  910.  *      Destructor for class CResultsDlg. Releases and Frees memory
  911.  *      allocated in this class
  912.  *
  913.  */
  914. /*******************************************************************/
  915.  
  916. CResultsDlg::~CResultsDlg()
  917. {
  918.  
  919.  
  920.  
  921.  
  922. /*******************************************************************/
  923. /*
  924.  -  CResultsDlg::
  925.  -  OnDumpPropValsBeforeToFile
  926.  *
  927.  *  Purpose:
  928.  *      Store PropValues in object to file
  929.  */
  930. /*******************************************************************/
  931.  
  932. void CResultsDlg::OnDumpPropValsBeforeToFile()
  933. {
  934.     char                szTag[80];
  935.     char                szFileName[80];
  936.     CStorePropValDlg    StoreProp(this);
  937.     LPTSTR              lpszTemp;
  938.         
  939.     // find file to open
  940.     lpszTemp = getenv("MAPITEST");
  941.  
  942.     if(lpszTemp)
  943.         strcpy(szFileName, lpszTemp);
  944.     else
  945.         strcpy(szFileName, "c:\\mapitest");
  946.  
  947.     strcat(szFileName, "\\data\\propvu.txt");
  948.  
  949.     // create the tag with braces around it
  950.     strcpy(szTag,"[PROPS BEFORE 0001]");
  951.  
  952.     StoreProp.m_TagID       = szTag;
  953.     StoreProp.m_FileName    = szFileName;
  954.     
  955.     if( StoreProp.DoModal() == IDOK )
  956.     {    
  957.         if((m_cValuesBefore != 0) && (m_lpspvaBefore != NULL) )
  958.         {
  959.             WritePropValArray(  StoreProp.m_szFileName,
  960.                                 StoreProp.m_szTagID,
  961.                                 m_cValuesBefore,
  962.                                 m_lpspvaBefore,
  963.                                 StoreProp.m_ulFlags);
  964.         }                        
  965.     }
  966. }
  967.  
  968. /*******************************************************************/
  969. /*
  970.  -  CResultsDlg::
  971.  -  OnDumpPropValsAfterToFile
  972.  *
  973.  *  Purpose:
  974.  *      Store PropValues in object to file
  975.  */
  976. /*******************************************************************/
  977.  
  978. void CResultsDlg::OnDumpPropValsAfterToFile()
  979. {
  980.     char                szTag[80];
  981.     char                szFileName[80];
  982.     CStorePropValDlg    StoreProp(this);
  983.     LPTSTR              lpszTemp;
  984.         
  985.     // find file to open
  986.     lpszTemp = getenv("MAPITEST");
  987.  
  988.     if(lpszTemp)
  989.         strcpy(szFileName, lpszTemp);
  990.     else
  991.         strcpy(szFileName, "c:\\mapitest");
  992.  
  993.     strcat(szFileName, "\\data\\propvu.txt");
  994.  
  995.     // create the tag with braces around it
  996.     strcpy(szTag,"[PROPS AFTER 0001]");
  997.  
  998.     StoreProp.m_TagID       = szTag;
  999.     StoreProp.m_FileName    = szFileName;
  1000.     
  1001.     if( StoreProp.DoModal() == IDOK )
  1002.     {    
  1003.         if((m_cValuesAfter != 0) && (m_lpspvaAfter != NULL) )
  1004.         {
  1005.             WritePropValArray( StoreProp.m_szFileName,
  1006.                         StoreProp.m_szTagID,
  1007.                         m_cValuesAfter,
  1008.                         m_lpspvaAfter,
  1009.                         StoreProp.m_ulFlags);
  1010.         }                        
  1011.     }
  1012. }
  1013. /*******************************************************************/
  1014. /*
  1015.  -  CResultsDlg::
  1016.  -  OnDumpProblemsToFile
  1017.  *
  1018.  *  Purpose:
  1019.  *      Store PropValues in object to file
  1020.  */
  1021. /*******************************************************************/
  1022.  
  1023. void CResultsDlg::OnDumpProblemsToFile()
  1024. {
  1025.     char                szTag[80];
  1026.     char                szFileName[80];
  1027.     LPTSTR              lpszTemp;
  1028.     CStorePropValDlg    StoreProp(this);
  1029.         
  1030.     // find file to open
  1031.     lpszTemp = getenv("MAPITEST");
  1032.  
  1033.     if(lpszTemp)
  1034.         strcpy(szFileName, lpszTemp);
  1035.     else
  1036.         strcpy(szFileName, "c:\\mapitest");
  1037.  
  1038.     strcat(szFileName, "\\data\\propvu.txt");
  1039.  
  1040.     // create the tag with braces around it
  1041.     strcpy(szTag,"[PROBLEM 0001]");       
  1042.  
  1043.     StoreProp.m_TagID       = szTag;
  1044.     StoreProp.m_FileName    = szFileName;
  1045.         
  1046.     if( StoreProp.DoModal() == IDOK )
  1047.     {    
  1048.         WriteProblemArray( StoreProp.m_szFileName,
  1049.                       StoreProp.m_szTagID,
  1050.                       m_lpProblems);
  1051.     }
  1052. }
  1053.  
  1054.  
  1055. /*******************************************************************/
  1056. /*
  1057.  -  CBldPropDlg::
  1058.  -  OnDumpPropsModifyToFile
  1059.  *
  1060.  *  Purpose:
  1061.  */
  1062. /*******************************************************************/
  1063.  
  1064. void CResultsDlg::OnDumpPropsModifyToFile()
  1065. {
  1066.     char                szTag[80];
  1067.     char                szFileName[80];
  1068.     CStorePropValDlg    StoreProp(this);
  1069.     LPTSTR              lpszTemp;
  1070.         
  1071.     // find file to open
  1072.     lpszTemp = getenv("MAPITEST");
  1073.  
  1074.     if(lpszTemp)
  1075.         strcpy(szFileName, lpszTemp);
  1076.     else
  1077.         strcpy(szFileName, "c:\\mapitest");
  1078.  
  1079.     strcat(szFileName, "\\data\\propvu.txt");
  1080.  
  1081.     // create the tag with braces around it
  1082.     strcpy(szTag,"[PROPS MODIFY 0001]");
  1083.  
  1084.     StoreProp.m_TagID       = szTag;
  1085.     StoreProp.m_FileName    = szFileName;
  1086.     
  1087.     if( StoreProp.DoModal() == IDOK )
  1088.     {    
  1089.         // if it is a prop tag array 
  1090.         if(m_lpsptaModify)
  1091.         {   
  1092.             WritePropTagArray(  StoreProp.m_szFileName,
  1093.                             StoreProp.m_szTagID,
  1094.                             m_lpsptaModify);
  1095.         }
  1096.         else        
  1097.         {                    
  1098.             WritePropValArray( StoreProp.m_szFileName,
  1099.                             StoreProp.m_szTagID,
  1100.                             m_cValuesModify,
  1101.                             m_lpspvaModify,
  1102.                             StoreProp.m_ulFlags);
  1103.         }                            
  1104.     }    
  1105. }
  1106.  
  1107.  
  1108.  
  1109.