home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / tutsamp / comobj / comobj.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-04  |  4.2 KB  |  132 lines

  1. /*+==========================================================================
  2.   File:      COMOBJ.H
  3.  
  4.   Summary:   Include file for the COMOBJ.DLL dynamic link library that
  5.              provides access to the services of the COMOBJ DLL.  This
  6.              include file is meant to serve double duty as providing
  7.              general set of macros that (1) when included in a COMOBJ
  8.              implementation file wherein it provides a STDENTRY macro for
  9.              the definition of exported functions and (2) when included in
  10.              an app that uses these function calls it provides a STDENTRY
  11.              macro for the declaration of imported functions.  The default
  12.              behavior is to serve consumer apps that import the functions
  13.              in the providing DLL.  Prior to the #include of this COMOBJ.H
  14.              if _DLLEXPORT_ is #defined, the STDENTRY, STDENTRY_ and
  15.              DLLENTRY macro expansion bahavior is directed to serve the
  16.              COMOBJ itself in defining the functions as exported. If
  17.              _DLLEXPORT_ is not defined and _LOCALCALLS_ is defined before
  18.              the #include then the STDENTRY macro reduces to externs for
  19.              support of local calls within the modules of the DLL.
  20.  
  21.              This .H file is written to be #included in either C or C++
  22.              programs.
  23.  
  24.              For a comprehensive tutorial code tour of COMOBJ's
  25.              contents and offerings see the tutorial COMOBJ.HTM file.
  26.              For more specific technical details on the internal workings
  27.              see the comments dispersed throughout the COMOBJ source code.
  28.  
  29.   Classes:   none
  30.  
  31.   Functions: none
  32.  
  33.   Origin:    10-3-97: atrent - Editor-inheritance from DLLSKEL.H in
  34.                the DLLSKEL Tutorial Code Sample. [Revised]
  35.  
  36. ----------------------------------------------------------------------------
  37.   This file is part of the Microsoft COM Tutorial Code Samples.
  38.  
  39.   Copyright (C) Microsoft Corporation, 1997.  All rights reserved.
  40.  
  41.   This source code is intended only as a supplement to Microsoft
  42.   Development Tools and/or on-line documentation.  See these other
  43.   materials for detailed information regarding Microsoft code samples.
  44.  
  45.   THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  46.   KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  47.   IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  48.   PARTICULAR PURPOSE.
  49. ==========================================================================+*/
  50.  
  51. #if !defined(COMOBJ_H)
  52. #define COMOBJ_H
  53.  
  54. #if !defined(RC_INCLUDE)
  55.  
  56. #if !defined(_DLLEXPORT_)
  57.  
  58. // If _DLLEXPORT_ is not defined then the default is to import.
  59. #if defined(__cplusplus)
  60.  
  61. #if defined(_LOCALCALLS_)
  62. #define DLLENTRY extern "C"
  63. #else
  64. #define DLLENTRY extern "C" __declspec(dllimport)
  65. #endif
  66.  
  67. #else   // __cplusplus
  68.  
  69. #if defined(_LOCALCALLS_)
  70. #define DLLENTRY extern
  71. #else
  72. #define DLLENTRY extern __declspec(dllimport)
  73. #endif
  74.  
  75. #endif  // __cplusplus
  76.  
  77. #define STDENTRY DLLENTRY HRESULT WINAPI
  78. #define STDENTRY_(type) DLLENTRY type WINAPI
  79.  
  80. // Here is the list of service APIs offered by the DLL (using the
  81. // appropriate entry API declaration macros just #defined above).
  82.  
  83. STDENTRY_(BOOL) ComObjInitMsgLog(
  84.                   CMsgLog* pMsgLog);
  85.  
  86. STDENTRY_(BOOL) ComObjAboutBox (HWND);
  87.  
  88. STDENTRY CreateCar(
  89.            IUnknown* pUnkOuter,
  90.            REFIID riid,
  91.            PPVOID ppv);
  92.  
  93. STDENTRY CreateUtilityCar(
  94.            IUnknown* pUnkOuter,
  95.            REFIID riid,
  96.            PPVOID ppv);
  97.  
  98. STDENTRY CreateCruiseCar(
  99.            IUnknown* pUnkOuter,
  100.            REFIID riid,
  101.            PPVOID ppv);
  102.  
  103. #else  // _DLLEXPORT_
  104.  
  105. // Else if _DLLEXPORT_ is defined then we've been told to export.
  106. #if defined(__cplusplus)
  107.  
  108. #if defined(_LOCALCALLS_)
  109. #define DLLENTRY extern "C"
  110. #else
  111. #define DLLENTRY extern "C" __declspec(dllexport)
  112. #endif
  113.  
  114. #else   // __cplusplus
  115.  
  116. #if defined(_LOCALCALLS_)
  117. #define DLLENTRY
  118. #else
  119. #define DLLENTRY __declspec(dllexport)
  120. #endif
  121.  
  122. #endif  // __cplusplus
  123.  
  124. #define STDENTRY DLLENTRY HRESULT WINAPI
  125. #define STDENTRY_(type) DLLENTRY type WINAPI
  126.  
  127. #endif // _DLLEXPORT_
  128.  
  129. #endif // RC_INCLUDE
  130.  
  131. #endif // COMOBJ_H
  132.