home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / mapi / win16 / dev / sendapp / smplmapi.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-11  |  2.3 KB  |  89 lines

  1. /*
  2.  -  S M P L M A P I . C P P
  3.  -  Copyright (C) 1995 Microsoft Corporation
  4.  -
  5.  *  Purpose:
  6.  *      Simple MAPI stub function pointers
  7.  *
  8.  */
  9.  
  10.  
  11. #ifdef WIN32
  12. #ifdef _WIN95
  13. #define _INC_OLE
  14. #endif
  15. #define INC_OLE2
  16. #define INC_RPC
  17. #endif
  18.  
  19. #include <afxwin.h>     
  20. #include <windowsx.h>
  21. #include <string.h>
  22.  
  23. #ifdef WIN16
  24. #include <compobj.h>
  25. #endif
  26.  
  27. #ifdef WIN32
  28. #include <objbase.h>
  29. #include <objerror.h>
  30. #ifdef _WIN95
  31. #include <ole2.h>
  32. #endif
  33. #endif
  34.  
  35.  
  36. #include <mapidefs.h>
  37. #include <mapi.h>
  38. #include <mapiwin.h>
  39. #include "smplmapi.h"
  40.  
  41. HINSTANCE hlibMAPI;
  42.  
  43. BOOL InitMapiDll()
  44. {             
  45.     
  46. #ifdef  WIN32
  47.     if (!(hlibMAPI = LoadLibrary ("MAPI" szMAPIDLLSuffix ".DLL")))
  48. #else
  49.     if ((UINT)(hlibMAPI = LoadLibrary ("MAPI.DLL")) < 32)
  50. #endif
  51.         return (FALSE);
  52.  
  53.     if (!(lpfnMAPILogon = (LPFNMAPILOGON) GetProcAddress (hlibMAPI, "MAPILogon")))
  54.         return (FALSE);
  55.     if (!(lpfnMAPILogoff = (LPFNMAPILOGOFF) GetProcAddress (hlibMAPI, "MAPILogoff")))
  56.         return (FALSE);
  57.     if (!(lpfnMAPISendMail = (LPFNMAPISENDMAIL) GetProcAddress (hlibMAPI, "MAPISendMail")))
  58.         return (FALSE);
  59.     if (!(lpfnMAPISendDocuments = (LPFNMAPISENDDOCUMENTS) GetProcAddress (hlibMAPI, "MAPISendDocuments")))
  60.         return (FALSE);
  61.     if (!(lpfnMAPIFindNext = (LPFNMAPIFINDNEXT) GetProcAddress (hlibMAPI, "MAPIFindNext")))
  62.         return (FALSE);
  63.     if (!(lpfnMAPIReadMail = (LPFNMAPIREADMAIL) GetProcAddress (hlibMAPI, "MAPIReadMail")))
  64.         return (FALSE);
  65.     if (!(lpfnMAPISaveMail = (LPFNMAPISAVEMAIL) GetProcAddress (hlibMAPI, "MAPISaveMail")))
  66.         return (FALSE);
  67.     if (!(lpfnMAPIDeleteMail = (LPFNMAPIDELETEMAIL) GetProcAddress (hlibMAPI, "MAPIDeleteMail")))
  68.         return (FALSE);
  69.     if (!(lpfnMAPIFreeBuffer = (LPFNMAPIFREEBUFFER) GetProcAddress (hlibMAPI, "MAPIFreeBuffer")))
  70.         return (FALSE);
  71.     if (!(lpfnMAPIAddress = (LPFNMAPIADDRESS) GetProcAddress (hlibMAPI, "MAPIAddress")))
  72.         return (FALSE);
  73.     if (!(lpfnMAPIDetails = (LPFNMAPIDETAILS) GetProcAddress (hlibMAPI, "MAPIDetails")))
  74.         return (FALSE);
  75.     if (!(lpfnMAPIResolveName = (LPFNMAPIRESOLVENAME) GetProcAddress (hlibMAPI, "MAPIResolveName")))
  76.         return (FALSE);
  77.  
  78.     return (TRUE);
  79. }
  80.  
  81. void DeinitSimpleMAPI ()
  82. {
  83.     if (hlibMAPI)
  84.     {
  85.         FreeLibrary (hlibMAPI);
  86.         hlibMAPI = 0;
  87.     }
  88. }
  89.