1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef INCLUDED_SIMPLEMAPI_HXX 23 #define INCLUDED_SIMPLEMAPI_HXX 24 25 #define WIN32_LEAN_AND_MEAN 26 #if defined _MSC_VER 27 #pragma warning(push, 1) 28 #endif 29 #include <windows.h> 30 #include <mapi.h> 31 #ifndef __MINGW32__ 32 #include <mapix.h> 33 #endif 34 #if defined _MSC_VER 35 #pragma warning(pop) 36 #endif 37 38 namespace shell 39 { 40 class WinSysMapi 41 { 42 public: 43 /** 44 @throws std::runtime_error 45 if either the mapi32.dll could not be loaded at all 46 or necessary function exports are missing 47 */ 48 WinSysMapi(); // throws std::runtime_error; 49 50 ~WinSysMapi(); 51 52 ULONG MAPILogon( 53 ULONG ulUIParam, 54 LPTSTR lpszProfileName, 55 LPTSTR lpszPassword, 56 FLAGS flFlags, 57 ULONG ulReserved, 58 LPLHANDLE lplhSession ); 59 60 ULONG MAPILogoff( 61 LHANDLE lhSession, 62 ULONG ulUIParam, 63 FLAGS flFlags, 64 ULONG ulReserved ); 65 66 ULONG MAPISendMail( 67 LHANDLE lhSession, 68 ULONG ulUIParam, 69 lpMapiMessage lpMessage, 70 FLAGS flFlags, 71 ULONG ulReserved ); 72 73 private: 74 HMODULE m_hMapiDll; 75 LPMAPILOGON m_lpfnMapiLogon; 76 LPMAPILOGOFF m_lpfnMapiLogoff; 77 LPMAPISENDMAIL m_lpfnMapiSendMail; 78 }; 79 } 80 #endif 81