Beispiel #1
0
BOOL CMailMsg::MAPIInitialize()
{
	// Determine if there is default email program

	CString sMailClientName;
	if(!DetectMailClient(sMailClientName))
	{
		m_sErrorMsg = _T("Error detecting E-mail client");
		return FALSE;
	}
	else
	{
		m_sErrorMsg = _T("Detected E-mail client ") + sMailClientName;
	}

	// Load MAPI.dll

	m_hMapi = AtlLoadSystemLibraryUsingFullPath(_T("mapi32.dll"));
	if (!m_hMapi)
	{
		m_sErrorMsg = _T("Error loading mapi32.dll");
		return FALSE;
	}

	m_lpMapiSendMail = (LPMAPISENDMAIL)::GetProcAddress(m_hMapi, "MAPISendMail");

	m_bReady = !!m_lpMapiSendMail;

	if(!m_bReady)
	{
		m_sErrorMsg = _T("Not found required function entries in mapi32.dll");
	}

	return m_bReady;
}
Beispiel #2
0
BOOL CMailMsg::MAPIInitialize()
{   
   // Determine if there is default email program

   CString sMailClientName;
   if(!DetectMailClient(sMailClientName))
   {
     m_sErrorMsg = _T("Error detecting E-mail client");
     return FALSE;
   }
   else
   {
     m_sErrorMsg = _T("Detected E-mail client ") + sMailClientName;
   }
   
   
   // Load MAPI.dll

   m_hMapi = ::LoadLibrary(_T("mapi32.dll"));
   if (!m_hMapi)
   {
     m_sErrorMsg = _T("Error loading mapi32.dll");
     return FALSE;
   }

   m_lpCmcQueryConfiguration = (LPCMCQUERY)::GetProcAddress(m_hMapi, "cmc_query_configuration");
   m_lpCmcLogon = (LPCMCLOGON)::GetProcAddress(m_hMapi, "cmc_logon");
   m_lpCmcSend = (LPCMCSEND)::GetProcAddress(m_hMapi, "cmc_send");
   m_lpCmcLogoff = (LPCMCLOGOFF)::GetProcAddress(m_hMapi, "cmc_logoff");
   
   m_lpMapiLogon = (LPMAPILOGON)::GetProcAddress(m_hMapi, "MAPILogon");
   m_lpMapiSendMail = (LPMAPISENDMAIL)::GetProcAddress(m_hMapi, "MAPISendMail");
   m_lpMapiLogoff = (LPMAPILOGOFF)::GetProcAddress(m_hMapi, "MAPILogoff");

   m_bReady = (m_lpCmcLogon && m_lpCmcSend && m_lpCmcLogoff) ||
              (m_lpMapiLogon && m_lpMapiSendMail && m_lpMapiLogoff);

   if(!m_bReady)
   {
     m_sErrorMsg = _T("Not found required function entries in mapi32.dll");
   }

   return m_bReady;
}