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

  1. /*******************************************************************/
  2. /*
  3.  -  getlist.cpp
  4.  -  Copyright (C) 1995 Microsoft Corporation
  5.  -
  6.  *  Purpose:
  7.  *      Contains member functions for CGetPropListDlg
  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. #ifdef WIN16
  38. #include <mapiwin.h>    
  39. #endif
  40. #include <mapix.h>      
  41. #include <strtbl.h>     
  42. #include <misctool.h>
  43. #include "resource.h"   
  44. #include "propvu.h"  
  45. #include "getlist.h"
  46.  
  47.  
  48. /*******************************************************************/
  49. /**************************** GETPROPLIST **************************/
  50.  
  51. /********************************************************************/
  52. /*
  53.  -  CGetPropListDlg::
  54.  -  OnInitDialog
  55.  -
  56.  *  Purpose:
  57.  *
  58.  */
  59. /********************************************************************/
  60.  
  61. BOOL CGetPropListDlg::OnInitDialog()
  62. {
  63.     HRESULT         hResult         = hrSuccess;
  64.     CGetError       E;
  65.     int             rgTabStops[4];
  66.     DWORD           dwReturn        = 0;      
  67.         
  68.     SendDlgItemMessage(IDC_LIST_DISPLAY,LB_RESETCONTENT,0,0);
  69.  
  70.  
  71.     if( !m_lpPropTagArray)
  72.     {
  73.         MessageBox( "CGetPropListDlg::OnInitDialog  lpPropTagArray == NULL",
  74.                     "Client", MBS_ERROR );
  75.         goto error;
  76.     }           
  77.  
  78.  
  79.     rgTabStops[0] = PROP_LISTBOX_TAB1_SIZE + 20 ;
  80.     rgTabStops[1] = PROP_LISTBOX_TAB2_SIZE ;
  81.  
  82.     dwReturn = SendDlgItemMessage(IDC_LIST_DISPLAY,LB_SETTABSTOPS,
  83.                     (WPARAM) 2,(LPARAM)rgTabStops );
  84.  
  85.     DisplayPropList();
  86.  
  87.     return TRUE;    
  88.  
  89. error:
  90.  
  91.     return FALSE;
  92. }
  93.  
  94. /*******************************************************************/
  95. /*
  96.  -  CBldPropDlg::
  97.  -  DisplayPropList
  98.  *
  99.  *  Purpose:
  100.  *
  101.  *  Parameters:
  102.  *
  103.  *  Returns:
  104.  *
  105.  */
  106. /*******************************************************************/
  107.  
  108. void CGetPropListDlg::DisplayPropList()
  109. {
  110.     char            szBuffer[1024];
  111.     int             idx             = 0;
  112.     DWORD           dwReturn        = 0;      
  113.     char            szCValues[30];
  114.     char szID[50];
  115.     char szType[32];      // Assumes no PropType string longer than 31 chars
  116.  
  117.         
  118.     // DISPLAY Expected lpPTA->cValues
  119.     wsprintf(szCValues,"cValues:  %lu",m_lpPropTagArray->cValues);
  120.     SetDlgItemText(IDT_LIST_CVALUES,szCValues);
  121.  
  122.     szBuffer[0] = '\0' ;
  123.  
  124.     SendDlgItemMessage(IDC_LIST_DISPLAY,LB_RESETCONTENT,0,0);
  125.            
  126.     for(idx = 0; idx < m_lpPropTagArray->cValues; idx++)
  127.     {   
  128.         szID[0]     = '\0' ;
  129.         szType[0]   = '\0' ;
  130.         szBuffer[0] = '\0' ;
  131.             
  132.         if(GetString("PropIDs", PROP_ID(m_lpPropTagArray->aulPropTag[idx]), szID ) )
  133.         {
  134.             lstrcat(szBuffer, szID );               
  135.             lstrcat(szBuffer, "\t");
  136.         }
  137.         else
  138.         {
  139.             wsprintf(szBuffer,"%#04X\t", PROP_ID(m_lpPropTagArray->aulPropTag[idx]) );      
  140.         }
  141.  
  142.         if( GetString("PropType", PROP_TYPE(m_lpPropTagArray->aulPropTag[idx]), szType) )
  143.         {
  144.             lstrcat(szBuffer, szType);
  145.             lstrcat(szBuffer,"\t");
  146.         }       
  147.         else
  148.         {
  149.             wsprintf(szType,"%#04X\t", PROP_TYPE(m_lpPropTagArray->aulPropTag[idx]) );
  150.             lstrcat(szBuffer,szType);
  151.         }
  152.         dwReturn = SendDlgItemMessage(IDC_LIST_DISPLAY,LB_ADDSTRING,0,
  153.                             (LPARAM)szBuffer);
  154.     
  155.     }  
  156.     
  157.     dwReturn = SendDlgItemMessage(IDC_LIST_DISPLAY,LB_SETCURSEL,(WPARAM) -1 ,0 );
  158.  
  159. }
  160.  
  161. /*******************************************************************/
  162. /*
  163.  -  CGetPropListDlg::
  164.  -  ~CGetPropListDlg
  165.  -
  166.  *  Purpose:
  167.  *      Destructor for class CGetPropListDlg. Releases and Frees memory
  168.  *      allocated in this class
  169.  *
  170.  */
  171. /*******************************************************************/
  172.  
  173. CGetPropListDlg::~CGetPropListDlg()
  174. {
  175.  
  176.  
  177.