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

  1. /*******************************************************************/
  2. /*
  3.  -  iid.cpp
  4.  -  Copyright (C) 1995 Microsoft Corporation
  5.  -
  6.  *  Purpose:
  7.  *      Contains member functions for CIntefaceDlg
  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.  
  39. #ifdef WIN16
  40. #include <mapiwin.h>    
  41. #endif
  42. #include <mapix.h>      
  43. #include <strtbl.h>     
  44. #include <misctool.h>
  45. #include <pvalloc.h>
  46. #include "resource.h"   
  47. #include "propvu.h"  
  48. #include "iid.h"
  49.  
  50.  
  51.  
  52. /*******************************************************************/
  53. /**************************** INTERFACE   **************************/
  54.  
  55.  
  56. BEGIN_MESSAGE_MAP(CInterfaceDlg, CDialog)
  57.  
  58.     ON_COMMAND( IDC_INTERFACE_ADD,      OnAddInterface)
  59.     ON_COMMAND( IDC_INTERFACE_REMOVE,   OnRemoveInterface)
  60.  
  61. END_MESSAGE_MAP()
  62.  
  63.  
  64. /********************************************************************/
  65. /*
  66.  -  CIntefaceDlg::
  67.  -  OnInitDialog
  68.  -
  69.  *  Purpose:
  70.  *
  71.  */
  72. /********************************************************************/
  73.  
  74. BOOL CInterfaceDlg::OnInitDialog()
  75. {
  76.     DWORD           dwReturn        = 0;            
  77.  
  78.     SendDlgItemMessage(IDC_INTERFACE_SELECTED,LB_RESETCONTENT,0,0);
  79.     SendDlgItemMessage(IDC_INTERFACE_AVAILABLE,LB_RESETCONTENT,0,0);
  80.     
  81.     SetWindowText( "Build IID array to Exclude in lpObj->CopyTo() operation" );
  82.  
  83.     m_ciidSelect = 0;
  84.     
  85.     DisplayInterfaces();
  86.  
  87.     return TRUE;    
  88.  
  89. }
  90.  
  91. /*******************************************************************/
  92. /*
  93.  -  CBldPropDlg::
  94.  -  DisplayInterfaces
  95.  *
  96.  *  Purpose:
  97.  *
  98.  *  Parameters:
  99.  *
  100.  *  Returns:
  101.  *
  102.  */
  103. /*******************************************************************/
  104.  
  105. void CInterfaceDlg::DisplayInterfaces()
  106. {
  107.     int             idx             = 0;
  108.     DWORD           dwReturn        = 0;      
  109.     
  110.     SendDlgItemMessage(IDC_INTERFACE_SELECTED,LB_RESETCONTENT,0,0);
  111.     SendDlgItemMessage(IDC_INTERFACE_AVAILABLE,LB_RESETCONTENT,0,0);
  112.  
  113.     // AVAILABLE LIST
  114.     for(idx = 0; idx < NUM_INTERFACES; idx++)
  115.     {           
  116.         dwReturn = SendDlgItemMessage(IDC_INTERFACE_AVAILABLE,LB_ADDSTRING,0,
  117.                                 (LPARAM) AllIIDs[idx].lpsz);
  118.     }
  119.  
  120.  
  121.     // SELECTED LIST
  122.     for(idx = 0; idx < m_ciidSelect ; idx++)
  123.     {           
  124.         // get string associated with interface
  125.         dwReturn = SendDlgItemMessage(IDC_INTERFACE_SELECTED,LB_ADDSTRING,0,
  126.                                 (LPARAM) m_rgszSelected[idx]);
  127.     }
  128.     
  129.     dwReturn = SendDlgItemMessage(IDC_INTERFACE_AVAILABLE,LB_SETCURSEL,(WPARAM) -1 ,0 );
  130.  
  131. }
  132.  
  133. /*******************************************************************/
  134. /*
  135.  -  CInterfaceDlg::
  136.  -  ~CInterfaceDlg
  137.  -
  138.  *  Purpose:
  139.  *      Destructor for class CInterfaceDlg. Releases and Frees memory
  140.  *      allocated in this class
  141.  *
  142.  */
  143. /*******************************************************************/
  144.  
  145. CInterfaceDlg::~CInterfaceDlg()
  146. {
  147.  
  148.  
  149.  
  150. /*******************************************************************/
  151. /*
  152.  -  CInterfaceDlg::
  153.  -  OnAdd
  154.  -
  155.  *  Purpose:
  156.  *
  157.  */
  158. /*******************************************************************/
  159.  
  160. void CInterfaceDlg::OnAddInterface()
  161. {
  162.     LONG    lSelection  = -1;
  163.     
  164.     lSelection = SendDlgItemMessage(IDC_INTERFACE_AVAILABLE,LB_GETCURSEL,0,0 );
  165.     if(lSelection == LB_ERR)
  166.     {
  167.         MessageBox( "Please Select an Interface from the Available Interfaces to Add", 
  168.                 "Client", MBS_INFO );
  169.         return;
  170.     }
  171.    
  172.     m_ciidSelect++;
  173.     
  174.     CopyGuid( &(m_rgiidSelect[ m_ciidSelect -1]) , AllIIDs[lSelection].lpInterface);
  175.  
  176.     m_rgszSelected[m_ciidSelect -1] = (char *) PvAlloc(lstrlen(AllIIDs[lSelection].lpsz));        
  177.     lstrcpy(m_rgszSelected[m_ciidSelect -1], AllIIDs[lSelection].lpsz);
  178.  
  179.     DisplayInterfaces();
  180.  
  181.  
  182.  
  183.  
  184. /*******************************************************************/
  185. /*
  186.  -  CInterfaceDlg::
  187.  -  OnRemove
  188.  -
  189.  *  Purpose:
  190.  *
  191.  */
  192. /*******************************************************************/
  193.  
  194. void CInterfaceDlg::OnRemoveInterface()
  195. {
  196.     LONG    lSelection  = -1;
  197.     
  198.     lSelection = SendDlgItemMessage(IDC_INTERFACE_SELECTED,LB_GETCURSEL,0,0 );
  199.     if(lSelection == LB_ERR)
  200.     {
  201.         MessageBox( "Please Select an Interface from the Selected Interfaces to Remove",
  202.                  "Client", MBS_INFO );
  203.         return;
  204.     }
  205.   
  206.     m_rgszSelected[lSelection] = m_rgszSelected[m_ciidSelect - 1];
  207.     lstrcpy(m_rgszSelected[lSelection],m_rgszSelected[m_ciidSelect - 1]);
  208.     m_ciidSelect--;
  209.  
  210.     DisplayInterfaces();
  211.  
  212.  
  213.