home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / ole / oleview / iviewers / iviewer.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.6 KB  |  92 lines

  1. // iviewer.h : implementation file
  2. //
  3. // Base iviewer class
  4. //
  5. //
  6.  
  7. // This is a part of the Microsoft Foundation Classes C++ library.
  8. // Copyright (C) 1992-1998 Microsoft Corporation
  9. // All rights reserved.
  10. //
  11. // This source code is only intended as a supplement to the
  12. // Microsoft Foundation Classes Reference and related
  13. // electronic documentation provided with the library.
  14. // See these sources for detailed information regarding the
  15. // Microsoft Foundation Classes product.
  16.  
  17. #include "stdafx.h"
  18. #include "iviewers.h"
  19. #include "iviewer.h"
  20.  
  21.  
  22. #ifdef _DEBUG
  23. #undef THIS_FILE
  24. static char BASED_CODE THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CInterfaceViewer command target
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CInterfaceViewer
  33.  
  34. IMPLEMENT_DYNAMIC(CInterfaceViewer, CCmdTarget)
  35.  
  36. CInterfaceViewer::CInterfaceViewer()
  37. {
  38.     AfxOleLockApp() ;
  39. }
  40.  
  41. CInterfaceViewer::~CInterfaceViewer()
  42. {
  43.     AfxOleUnlockApp() ;
  44. }
  45.  
  46. HRESULT CInterfaceViewer::OnView(HWND /*hwndParent*/, REFIID /*riid*/, LPUNKNOWN /*punk*/)
  47. {
  48.     AfxMessageBox(_T("Implement interface viewer UI here.") ) ;
  49.     return NOERROR ;
  50. }
  51.  
  52. BEGIN_MESSAGE_MAP(CInterfaceViewer, CCmdTarget)
  53.     //{{AFX_MSG_MAP(CInterfaceViewer)
  54.         // NOTE - the ClassWizard will add and remove mapping macros here.
  55.     //}}AFX_MSG_MAP
  56. END_MESSAGE_MAP()
  57.  
  58.  
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CInterfaceViewer message handlers
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. // IInterfaceViewer implementation
  64.  
  65. BEGIN_INTERFACE_MAP(CInterfaceViewer, CCmdTarget)
  66.     INTERFACE_PART(CInterfaceViewer, IID_IInterfaceViewer, InterfaceViewer)
  67. END_INTERFACE_MAP()
  68.  
  69. STDMETHODIMP_(ULONG) CInterfaceViewer::XInterfaceViewer::AddRef()
  70. {
  71.     METHOD_PROLOGUE(CInterfaceViewer, InterfaceViewer)
  72.     return pThis->ExternalAddRef();
  73. }
  74.  
  75. STDMETHODIMP_(ULONG) CInterfaceViewer::XInterfaceViewer::Release()
  76. {
  77.     METHOD_PROLOGUE(CInterfaceViewer, InterfaceViewer)
  78.     return pThis->ExternalRelease();
  79. }
  80.  
  81. STDMETHODIMP CInterfaceViewer::XInterfaceViewer::QueryInterface(REFIID iid, void** ppvObj)
  82. {
  83.     METHOD_PROLOGUE(CInterfaceViewer, InterfaceViewer)
  84.     return (HRESULT)pThis->ExternalQueryInterface(&iid, ppvObj) ;
  85. }
  86.  
  87. STDMETHODIMP CInterfaceViewer::XInterfaceViewer::View(HWND hwndParent, REFIID riid, LPUNKNOWN punk)
  88. {
  89.     METHOD_PROLOGUE(CInterfaceViewer, InterfaceViewer)
  90.     return pThis->OnView( hwndParent, riid, punk ) ;
  91. }
  92.