home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / wabapi.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  7KB  |  199 lines

  1. #ifndef _WABAPI_H_
  2. #define _WABAPI_H_
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #ifdef WIN16
  9. #ifdef GetLastError
  10. #undef GetLastError
  11. #endif // GetLastError
  12. #endif // WIN16
  13.  
  14. /* IWABObject Interface ---------------------------------------------------- */
  15.  
  16. #define CBIWABOBJECT sizeof(IWABOBJECT)
  17.  
  18.  
  19. #define WAB_IWABOBJECT_METHODS(IPURE)                       \
  20.         MAPIMETHOD(GetLastError)                            \
  21.             (THIS_  HRESULT hResult,                        \
  22.                     ULONG   ulFlags,                        \
  23.                     LPMAPIERROR FAR * lppMAPIError) IPURE;  \
  24.         MAPIMETHOD(AllocateBuffer)                          \
  25.             (THIS_  ULONG   cbSize,                         \
  26.                     LPVOID FAR *    lppBuffer) IPURE;       \
  27.         MAPIMETHOD(AllocateMore)                            \
  28.             (THIS_  ULONG   cbSize,                         \
  29.                     LPVOID  lpObject,                       \
  30.                     LPVOID  FAR *   lppBuffer) IPURE;       \
  31.         MAPIMETHOD(FreeBuffer)                              \
  32.             (THIS_  LPVOID  lpBuffer) IPURE;                \
  33.         MAPIMETHOD(Backup)                                  \
  34.             (THIS_  LPTSTR  lpFileName) IPURE;              \
  35.         MAPIMETHOD(Import)                                  \
  36.             (THIS_   LPTSTR lpFileName) IPURE;              \
  37.         MAPIMETHOD(Find)                                    \
  38.             (THIS_  LPADRBOOK lpIAB,                        \
  39.                     HWND    hWnd) IPURE;                    \
  40.         MAPIMETHOD(VCardDisplay)                            \
  41.             (THIS_  LPADRBOOK lpIAB,                        \
  42.                     HWND    hWnd,                           \
  43.                     LPTSTR  lpszFileName) IPURE;            \
  44.         MAPIMETHOD(LDAPUrl)                                 \
  45.             (THIS_  LPADRBOOK   lpIAB,                      \
  46.                     HWND        hWnd,                       \
  47.                     ULONG       ulFlags,                    \
  48.                     LPTSTR      lpszURL,                    \
  49.                     LPMAILUSER *lppMailUser) IPURE;         \
  50.         MAPIMETHOD(VCardCreate)                             \
  51.             (THIS_  LPADRBOOK   lpIAB,                      \
  52.                     ULONG       ulFlags,                    \
  53.                     LPTSTR      lpszVCard,                  \
  54.                     LPMAILUSER  lpMailUser) IPURE;          \
  55.         MAPIMETHOD(VCardRetrieve)                           \
  56.             (THIS_  LPADRBOOK   lpIAB,                      \
  57.                     ULONG       ulFlags,                    \
  58.                     LPTSTR      lpszVCard,                  \
  59.                     LPMAILUSER *lppMailUser) IPURE;         \
  60.         MAPIMETHOD(GetMe)                                   \
  61.             (THIS_  LPADRBOOK   lpIAB,                      \
  62.                     ULONG       ulFlags,                    \
  63.                     DWORD *     lpdwAction,                 \
  64.                     SBinary *   lpsbEID,                    \
  65.                     ULONG       ulReserved) IPURE;          \
  66.         MAPIMETHOD(SetMe)                                   \
  67.             (THIS_  LPADRBOOK   lpIAB,                      \
  68.                     ULONG       ulFlags,                    \
  69.                     SBinary     sbEID,                      \
  70.                     ULONG       ulReserved) IPURE;          \
  71.  
  72.  
  73.  
  74. #undef           INTERFACE
  75. #define          INTERFACE      IWABObject
  76. DECLARE_MAPI_INTERFACE_(IWABObject, IUnknown)
  77. {
  78.         BEGIN_INTERFACE
  79.         MAPI_IUNKNOWN_METHODS(PURE)
  80.         WAB_IWABOBJECT_METHODS(PURE)
  81. };
  82.  
  83. DECLARE_MAPI_INTERFACE_PTR(IWABObject, LPWABOBJECT);
  84.  
  85.  
  86. #undef  INTERFACE
  87. #define INTERFACE       struct _IWABOBJECT
  88.  
  89. #undef  METHOD_PREFIX
  90. #define METHOD_PREFIX   IWABOBJECT_
  91.  
  92. #undef  LPVTBL_ELEM
  93. #define LPVTBL_ELEM             lpvtbl
  94.  
  95. #undef  MAPIMETHOD_
  96. #define MAPIMETHOD_(type, method)       MAPIMETHOD_DECLARE(type, method, IWABOBJECT_)
  97.                 MAPI_IUNKNOWN_METHODS(IMPL)
  98.        WAB_IWABOBJECT_METHODS(IMPL)
  99. #undef  MAPIMETHOD_
  100. #define MAPIMETHOD_(type, method)       MAPIMETHOD_TYPEDEF(type, method, IWABOBJECT_)
  101.                 MAPI_IUNKNOWN_METHODS(IMPL)
  102.        WAB_IWABOBJECT_METHODS(IMPL)
  103. #undef  MAPIMETHOD_
  104. #define MAPIMETHOD_(type, method)       STDMETHOD_(type, method)
  105.  
  106. DECLARE_MAPI_INTERFACE(IWABOBJECT_)
  107. {
  108.         BEGIN_INTERFACE
  109.         MAPI_IUNKNOWN_METHODS(IMPL)
  110.    WAB_IWABOBJECT_METHODS(IMPL)
  111. };
  112.  
  113.  
  114. // WABObject_LDAPUrl flag
  115. // If this flag is specified and the LDAPUrl returns a single
  116. // query result, instructs the WAB to return the result in the
  117. // form of a MailUser object instead of displaying Details on it
  118. // If there are multiple results to the query, fail ..
  119. #define WABOBJECT_LDAPURL_RETURN_MAILUSER   0x00000001
  120.  
  121.  
  122. // WABObject_GetMe returned parameter
  123. // If the GetMe call results in the creation of a new 'Me' contact,
  124. // the lpdwAction returned parameter will contain this value
  125. // indicating to the caller that the object is freshly created and
  126. // does not have an properties in it
  127. #define WABOBJECT_ME_NEW                    0x00000001
  128.  
  129.  
  130. // IWABObject_VCard Create/Retrieve
  131. // Flags the WAB whether the lpszVCard parameter is a filename or if
  132. // it is a NULL terminated string containing the compelte VCard contents
  133. //
  134. #define WAB_VCARD_FILE                      0x00000000
  135. #define WAB_VCARD_STREAM                    0x00000001
  136.  
  137. #ifdef WIN16
  138. BOOL WINAPI WABInitThread();
  139. #endif
  140.  
  141. //
  142. // Input information to pass to WABOpen
  143. //
  144. typedef struct _tagWAB_PARAM
  145. {
  146.     ULONG   cbSize;         // sizeof(WAB_PARAM).
  147.     HWND    hwnd;           // hWnd of calling client Application. Can be NULL
  148.     LPTSTR  szFileName;     // WAB File name to open. if NULL, opens default.
  149.     ULONG   ulFlags;        // Currently no flags.
  150. } WAB_PARAM, * LPWAB_PARAM;
  151.  
  152. //
  153. // Root public entry points for WAB API
  154. //
  155. STDMETHODIMP WABOpen(LPADRBOOK FAR * lppAdrBook, LPWABOBJECT FAR * lppWABObject,
  156.   LPWAB_PARAM lpWP, DWORD Reserved2);
  157.  
  158. typedef HRESULT (STDMETHODCALLTYPE WABOPEN)(
  159.     LPADRBOOK FAR * lppAdrBook,
  160.     LPWABOBJECT FAR * lppWABObject,
  161.     LPWAB_PARAM lpWP,
  162.     DWORD Reserved2
  163. );
  164. typedef WABOPEN FAR * LPWABOPEN;
  165.  
  166.  
  167. STDMETHODIMP WABOpenEx(LPADRBOOK FAR * lppAdrBook,
  168.   LPWABOBJECT FAR * lppWABObject,
  169.   LPWAB_PARAM lpWP,
  170.   DWORD Reserved,
  171.   ALLOCATEBUFFER * fnAllocateBuffer,
  172.   ALLOCATEMORE * fnAllocateMore,
  173.   FREEBUFFER * fnFreeBuffer);
  174.  
  175. typedef HRESULT (STDMETHODCALLTYPE WABOPENEX)(
  176.     LPADRBOOK FAR * lppAdrBook,
  177.     LPWABOBJECT FAR * lppWABObject,
  178.     LPWAB_PARAM lpWP,
  179.     DWORD Reserved,
  180.     ALLOCATEBUFFER * fnAllocateBuffer,
  181.     ALLOCATEMORE * fnAllocateMore,
  182.     FREEBUFFER * fnFreeBuffer
  183. );
  184. typedef WABOPENEX FAR * LPWABOPENEX;
  185.  
  186. #ifndef WIN16
  187. #define WAB_DLL_NAME "WAB32.DLL"
  188. #else
  189. #define WAB_DLL_NAME "WAB16.DLL"
  190. #endif
  191.  
  192. #define WAB_DLL_PATH_KEY TEXT("Software\\Microsoft\\WAB\\DLLPath")
  193.  
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197.  
  198. #endif /* _WABAPI_H */
  199.