home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / COMPOUND.ZIP / Stg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-09  |  2.7 KB  |  110 lines

  1. //
  2. //    Stg.cpp
  3. //+
  4. //    implementation file
  5. //-    
  6. //    rev 11/02/98 gls
  7. //
  8.  
  9. #include "stdafx.h"
  10. #include "gstg.h"
  11. #include "Stg.h"
  12.  
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CStg
  21.  
  22. IMPLEMENT_DYNCREATE(CStg, CCmdTarget)
  23.  
  24. CStg::CStg()
  25. {
  26.     EnableAutomation();
  27.     
  28.     // To keep the application running as long as an OLE automation 
  29.     //    object is active, the constructor calls AfxOleLockApp.
  30.     
  31.     AfxOleLockApp();
  32. }
  33.  
  34. CStg::~CStg()
  35. {
  36.     // To terminate the application when all objects created with
  37.     //     with OLE automation, the destructor calls AfxOleUnlockApp.
  38.     
  39.     AfxOleUnlockApp();
  40. }
  41.  
  42.  
  43. void CStg::OnFinalRelease()
  44. {
  45.     // When the last reference for an automation object is released
  46.     // OnFinalRelease is called.  The base class will automatically
  47.     // deletes the object.  Add additional cleanup required for your
  48.     // object before calling the base class.
  49.  
  50.     CCmdTarget::OnFinalRelease();
  51. }
  52.  
  53.  
  54. BEGIN_MESSAGE_MAP(CStg, CCmdTarget)
  55.     //{{AFX_MSG_MAP(CStg)
  56.         // NOTE - the ClassWizard will add and remove mapping macros here.
  57.     //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59.  
  60. BEGIN_DISPATCH_MAP(CStg, CCmdTarget)
  61.     //{{AFX_DISPATCH_MAP(CStg)
  62.     DISP_FUNCTION(CStg, "getStgCount", getStgCount, VT_I4, VTS_NONE)
  63.     DISP_FUNCTION(CStg, "getStg", getStg, VT_BSTR, VTS_I4)
  64.     DISP_FUNCTION(CStg, "Scan", Scan, VT_I4, VTS_BSTR VTS_BSTR)
  65.     //}}AFX_DISPATCH_MAP
  66. END_DISPATCH_MAP()
  67.  
  68. // Note: we add support for IID_IStg to support typesafe binding
  69. //  from VBA.  This IID must match the GUID that is attached to the 
  70. //  dispinterface in the .ODL file.
  71.  
  72. // {05641F41-7255-11D2-9F15-00A0246D0F63}
  73. static const IID IID_IStg =
  74. { 0x5641f41, 0x7255, 0x11d2, { 0x9f, 0x15, 0x0, 0xa0, 0x24, 0x6d, 0xf, 0x63 } };
  75.  
  76. BEGIN_INTERFACE_MAP(CStg, CCmdTarget)
  77.     INTERFACE_PART(CStg, IID_IStg, Dispatch)
  78. END_INTERFACE_MAP()
  79.  
  80. // {05641F42-7255-11D2-9F15-00A0246D0F63}
  81. IMPLEMENT_OLECREATE(CStg, "gstg.Stg", 0x5641f42, 0x7255, 0x11d2, 0x9f, 0x15, 0x0, 0xa0, 0x24, 0x6d, 0xf, 0x63)
  82.  
  83. // CStg message handlers
  84.  
  85. // ////////////////////////////////////////////////////////////
  86. long CStg::Scan(LPCTSTR pszFileStg, LPCTSTR pszStgSpec) 
  87. {
  88.  
  89.     return( S_OK );
  90. }
  91. // ////////////////////////////////////////////////////////////
  92.  
  93. long CStg::getStgCount() 
  94. {
  95.  
  96.     return( S_OK );
  97. }
  98. // ////////////////////////////////////////////////////////////
  99.  
  100. BSTR CStg::getStg(long iStg) 
  101. {
  102.     CString sResult;
  103.  
  104.     return( sResult.AllocSysString() );
  105. }
  106. // ////////////////////////////////////////////////////////////
  107. // ////////////////////////////////////////////////////////////
  108. // ////////////////////////////////////////////////////////////
  109.  
  110.