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