home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / wabapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  12.0 KB  |  313 lines

  1. #ifndef _WABAPI_H_
  2. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  3. #define _WABAPI_H_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #ifdef WIN16
  10. #ifdef GetLastError
  11. #undef GetLastError
  12. #endif // GetLastError
  13. #endif // WIN16
  14.  
  15. typedef struct _WABACTIONITEM * LPWABACTIONITEM;
  16.  
  17. /* IWABObject Interface ---------------------------------------------------- */
  18.  
  19. #define CBIWABOBJECT sizeof(IWABOBJECT)
  20.  
  21.  
  22. #define WAB_IWABOBJECT_METHODS(IPURE)                       \
  23.         MAPIMETHOD(GetLastError)                            \
  24.             (THIS_  HRESULT hResult,                        \
  25.                     ULONG   ulFlags,                        \
  26.                     LPMAPIERROR FAR * lppMAPIError) IPURE;  \
  27.         MAPIMETHOD(AllocateBuffer)                          \
  28.             (THIS_  ULONG   cbSize,                         \
  29.                     LPVOID FAR *    lppBuffer) IPURE;       \
  30.         MAPIMETHOD(AllocateMore)                            \
  31.             (THIS_  ULONG   cbSize,                         \
  32.                     LPVOID  lpObject,                       \
  33.                     LPVOID  FAR *   lppBuffer) IPURE;       \
  34.         MAPIMETHOD(FreeBuffer)                              \
  35.             (THIS_  LPVOID  lpBuffer) IPURE;                \
  36.         MAPIMETHOD(Backup)                                  \
  37.             (THIS_  LPSTR  lpFileName) IPURE;              \
  38.         MAPIMETHOD(Import)                                  \
  39.             (THIS_  LPSTR lpImportParam) IPURE;           \
  40.         MAPIMETHOD(Find)                                    \
  41.             (THIS_  LPADRBOOK lpIAB,                        \
  42.                     HWND    hWnd) IPURE;                    \
  43.         MAPIMETHOD(VCardDisplay)                            \
  44.             (THIS_  LPADRBOOK lpIAB,                        \
  45.                     HWND    hWnd,                           \
  46.                     LPSTR  lpszFileName) IPURE;            \
  47.         MAPIMETHOD(LDAPUrl)                                 \
  48.             (THIS_  LPADRBOOK   lpIAB,                      \
  49.                     HWND        hWnd,                       \
  50.                     ULONG       ulFlags,                    \
  51.                     LPSTR       lpszURL,                    \
  52.                     LPMAILUSER *lppMailUser) IPURE;         \
  53.         MAPIMETHOD(VCardCreate)                             \
  54.             (THIS_  LPADRBOOK   lpIAB,                      \
  55.                     ULONG       ulFlags,                    \
  56.                     LPSTR       lpszVCard,                  \
  57.                     LPMAILUSER  lpMailUser) IPURE;          \
  58.         MAPIMETHOD(VCardRetrieve)                           \
  59.             (THIS_  LPADRBOOK   lpIAB,                      \
  60.                     ULONG       ulFlags,                    \
  61.                     LPSTR       lpszVCard,                  \
  62.                     LPMAILUSER *lppMailUser) IPURE;         \
  63.         MAPIMETHOD(GetMe)                                   \
  64.             (THIS_  LPADRBOOK   lpIAB,                      \
  65.                     ULONG       ulFlags,                    \
  66.                     DWORD *     lpdwAction,                 \
  67.                     SBinary *   lpsbEID,                    \
  68.                     ULONG       ulParam) IPURE;          \
  69.         MAPIMETHOD(SetMe)                                   \
  70.             (THIS_  LPADRBOOK   lpIAB,                      \
  71.                     ULONG       ulFlags,                    \
  72.                     SBinary     sbEID,                      \
  73.                     ULONG       ulParam) IPURE;          \
  74.  
  75.  
  76.  
  77. #undef           INTERFACE
  78. #define          INTERFACE      IWABObject
  79. DECLARE_MAPI_INTERFACE_(IWABObject, IUnknown)
  80. {
  81.         BEGIN_INTERFACE
  82.         MAPI_IUNKNOWN_METHODS(PURE)
  83.         WAB_IWABOBJECT_METHODS(PURE)
  84. };
  85.  
  86. DECLARE_MAPI_INTERFACE_PTR(IWABObject, LPWABOBJECT);
  87.  
  88.  
  89. #undef  INTERFACE
  90. #define INTERFACE       struct _IWABOBJECT
  91.  
  92. #undef  METHOD_PREFIX
  93. #define METHOD_PREFIX   IWABOBJECT_
  94.  
  95. #undef  LPVTBL_ELEM
  96. #define LPVTBL_ELEM             lpvtbl
  97.  
  98. #undef  MAPIMETHOD_
  99. #define MAPIMETHOD_(type, method)       MAPIMETHOD_DECLARE(type, method, IWABOBJECT_)
  100.                 MAPI_IUNKNOWN_METHODS(IMPL)
  101.        WAB_IWABOBJECT_METHODS(IMPL)
  102. #undef  MAPIMETHOD_
  103. #define MAPIMETHOD_(type, method)       MAPIMETHOD_TYPEDEF(type, method, IWABOBJECT_)
  104.                 MAPI_IUNKNOWN_METHODS(IMPL)
  105.        WAB_IWABOBJECT_METHODS(IMPL)
  106. #undef  MAPIMETHOD_
  107. #define MAPIMETHOD_(type, method)       STDMETHOD_(type, method)
  108.  
  109. DECLARE_MAPI_INTERFACE(IWABOBJECT_)
  110. {
  111.         BEGIN_INTERFACE
  112.         MAPI_IUNKNOWN_METHODS(IMPL)
  113.    WAB_IWABOBJECT_METHODS(IMPL)
  114. };
  115.  
  116.  
  117. /*** WABObject_LDAPUrl flags ***/
  118.  
  119. // If this flag is specified and the LDAPUrl returns a single
  120. // query result, instructs the WAB to return the result in the
  121. // form of a MailUser object instead of displaying Details on it
  122. // If there are multiple results to the query, fail ..
  123. #define WABOBJECT_LDAPURL_RETURN_MAILUSER   0x00000001
  124.  
  125. // WAB 5.0x and higher:
  126. // If your application supports Unicode and wants to pass ina Unicode
  127. //  URL to the WAB, you can cast the Unicode URL to an LPSTR and pass it
  128. // to the LDAPUrl API, *also* setting ulFlags to MAPI_UNICODE to mark the URL
  129. // as such. Casting is prefered to converting the string because 
  130. // (a) Converting the string may result in loss of data (b) since this is an
  131. // already published interface we can't modify the interface.
  132. //      MAPI_UNICODE                        0x80000000
  133.  
  134.  
  135.  
  136. /*** WABObject_GetMe returned parameter ***/
  137. // If the GetMe call results in the creation of a new 'Me' contact,
  138. // the lpdwAction returned parameter will contain this value
  139. // indicating to the caller that the object is freshly created and
  140. // does not have any properties in it
  141. #define WABOBJECT_ME_NEW                    0x00000001
  142.  
  143.  
  144.  
  145. /*** WABObject_GetMe flags ***/
  146. // WABObject_GetMe will create a new ME object by default, if 
  147. // none already exists. To force the call to not-create an object, if
  148. // one doesn't already exist, specify the WABOBJECT_ME_NOCREATE flag.
  149. // If no me is found, the call fails with MAPI_E_NOT_FOUND.
  150. // Other flag for WABObject_GetMe is AB_NO_DIALOG defined in wabdefs.h
  151. #define WABOBJECT_ME_NOCREATE               0x00000002
  152.  
  153.  
  154.  
  155. /*** IWABObject_VCard Create/Retrieve ***/
  156. // Flags the WAB whether the lpszVCard parameter is a filename or if
  157. // it is a NULL terminated string containing the compelte VCard contents
  158. //
  159. #define WAB_VCARD_FILE                      0x00000000
  160. #define WAB_VCARD_STREAM                    0x00000001
  161.  
  162.  
  163.  
  164.  
  165.  
  166. #ifdef WIN16
  167. BOOL WINAPI WABInitThread();
  168. #endif
  169.  
  170.  
  171. //
  172. // Input information to pass to WABOpen
  173. //
  174. typedef struct _tagWAB_PARAM
  175. {
  176.     ULONG   cbSize;         // sizeof(WAB_PARAM).
  177.     HWND    hwnd;           // hWnd of calling client Application. Can be NULL
  178.     LPSTR   szFileName;     // WAB File name to open. if NULL, opens default.
  179.     ULONG   ulFlags;        // See below
  180.     GUID    guidPSExt;      // A GUID that identifies the calling application's Property Sheet extensions
  181.                             // The GUID can be used to determine whether the extension prop sheets are displayed or not.
  182. } WAB_PARAM, * LPWAB_PARAM;
  183.  
  184. //flags for WAB_PARAM
  185. #define WAB_USE_OE_SENDMAIL     0x00000001  // Tells WAB to use Outlook Express for e-mail before checking for a 
  186.                                             // default Simple MAPI client. Default behaviour is to check for the 
  187.                                             // Simple MAPI client first
  188.  
  189. #define WAB_ENABLE_PROFILES     0x00400000  // Invokes WAB in a Identity-aware session using Identity-Manager 
  190.                                             // based profiles
  191.  
  192.  
  193. //
  194. // Root public entry points for WAB API
  195. //
  196. STDMETHODIMP WABOpen(LPADRBOOK FAR * lppAdrBook, LPWABOBJECT FAR * lppWABObject,
  197.   LPWAB_PARAM lpWP, DWORD Reserved2);
  198.  
  199. typedef HRESULT (STDMETHODCALLTYPE WABOPEN)(
  200.     LPADRBOOK FAR * lppAdrBook,
  201.     LPWABOBJECT FAR * lppWABObject,
  202.     LPWAB_PARAM lpWP,
  203.     DWORD Reserved2
  204. );
  205. typedef WABOPEN FAR * LPWABOPEN;
  206.  
  207.  
  208. STDMETHODIMP WABOpenEx(LPADRBOOK FAR * lppAdrBook,
  209.   LPWABOBJECT FAR * lppWABObject,
  210.   LPWAB_PARAM lpWP,
  211.   DWORD Reserved,
  212.   ALLOCATEBUFFER * fnAllocateBuffer,
  213.   ALLOCATEMORE * fnAllocateMore,
  214.   FREEBUFFER * fnFreeBuffer);
  215.  
  216. typedef HRESULT (STDMETHODCALLTYPE WABOPENEX)(
  217.     LPADRBOOK FAR * lppAdrBook,
  218.     LPWABOBJECT FAR * lppWABObject,
  219.     LPWAB_PARAM lpWP,
  220.     DWORD Reserved,
  221.     ALLOCATEBUFFER * fnAllocateBuffer,
  222.     ALLOCATEMORE * fnAllocateMore,
  223.     FREEBUFFER * fnFreeBuffer
  224. );
  225. typedef WABOPENEX FAR * LPWABOPENEX;
  226.  
  227. /* --------------------- */
  228. typedef struct _WABIMPORTPARAM
  229. {
  230.     ULONG cbSize;       // sizeof(WABIMPORTPARAM)
  231.     LPADRBOOK lpAdrBook;// ptr to the IAdrBook object (required)
  232.     HWND hWnd;          // Parent HWND for any dialogs
  233.     ULONG ulFlags;      // 0 or MAPI_DIALOG to show progress dialog and messages
  234.     LPSTR lpszFileName; // FileName to import or NULL .. if NULL will show FileOpen dialog 
  235. } WABIMPORTPARAM, FAR * LPWABIMPORTPARAM;
  236.  
  237.  
  238.  
  239. /* ---- WABEXTDISPLAY ----------------- */
  240. /* WABEXTDISPLAY Structure used in extending the WAB Details Property Dialogs 
  241.     and for doing WAB Context Menu verb extensions.
  242.    The structure is passed into the IWABExtInit::Initialize method
  243.     of the implementor */
  244.  
  245. // Flags
  246. #define WAB_DISPLAY_LDAPURL 0x00000001  // The object being displayed is an LDAP URL
  247.                                         // The URL can be found in the lpsz struct member
  248.  
  249. #define WAB_CONTEXT_ADRLIST 0x00000002  // THe lpv parameter contains a pointer to an
  250.                                         // AdrList structure corresponding to selected items
  251.                                         // on which to display a context menu
  252.  
  253. #define WAB_DISPLAY_ISNTDS  0x00000004  // Identifies that the entry being displayed originated
  254.                                         // on the NT Directory Service, for clients that use ADSI and
  255.                                         // retrieve additional information from the service.
  256.  
  257. //      MAPI_UNICODE        0x80000000  // Indicates that the WED.lpsz string is actually a UNICODE
  258.                                         //  string and should be cast to a (LPWSTR) before using it
  259.                                         // If this flag is not present then the WED.lpsz is a DBCS string
  260.                                         //  and should be cast to an LPSTR before using.
  261.  
  262. // Struct
  263. typedef struct _WABEXTDISPLAY
  264. {
  265.     ULONG cbSize;
  266.     LPWABOBJECT lpWABObject;    // pointer to IWABObject
  267.     LPADRBOOK lpAdrBook;        // pointer to IAdrBook object
  268.     LPMAPIPROP lpPropObj;       // Object being displayed
  269.     BOOL fReadOnly;             // Indicates if this is a ReadOnly mode
  270.     BOOL fDataChanged;          // Set by extension sheet to signal data change
  271.     ULONG ulFlags;              // See above
  272.     LPVOID lpv;                 // Used for passing in specific data
  273.     LPTSTR lpsz;               // Used for passing in specific data
  274. } WABEXTDISPLAY, FAR * LPWABEXTDISPLAY;
  275.  
  276. /* --------------------- */
  277.  
  278. #define WAB_IWABEXTINIT_METHODS(IPURE)                          \
  279.         MAPIMETHOD(Initialize)                                  \
  280.             (THIS_  LPWABEXTDISPLAY lpWABExtDisplay)    IPURE;  \
  281.  
  282. #undef           INTERFACE
  283. #define          INTERFACE      IWABExtInit
  284. DECLARE_MAPI_INTERFACE_(IWABExtInit, IUnknown)
  285. {
  286.         BEGIN_INTERFACE
  287.         MAPI_IUNKNOWN_METHODS(PURE)
  288.         WAB_IWABEXTINIT_METHODS(PURE)
  289. };
  290.  
  291. DECLARE_MAPI_INTERFACE_PTR(IWABExtInit, LPWABEXTINIT);
  292.  
  293. DEFINE_GUID(IID_IWABExtInit, 
  294. 0xea22ebf0, 0x87a4, 0x11d1, 0x9a, 0xcf, 0x0, 0xa0, 0xc9, 0x1f, 0x9c, 0x8b);
  295.  
  296.  
  297. /* --------------------- */
  298.  
  299. #ifndef WIN16
  300. #define WAB_DLL_NAME TEXT("WAB32.DLL")
  301. #else
  302. #define WAB_DLL_NAME "WAB16.DLL"
  303. #endif
  304.  
  305. #define WAB_DLL_PATH_KEY TEXT("Software\\Microsoft\\WAB\\DLLPath")
  306.  
  307. #ifdef __cplusplus
  308. }
  309. #endif
  310.  
  311. #pragma option pop /*P_O_Pop*/
  312. #endif /* _WABAPI_H */
  313.