www.pudn.com > MailCheck_src.zip > Wakeme.h


/*************************************************************************** 
* Copyright (c) 1996, Microsoft Corporation 
* 
* Sample extended MAPI app with new mail notifications 
* 
* History: 
* 1 Oct 1996	Vajira Weerasekera 
\***************************************************************************/ 
 
// Wakeme.h : main header file for the WAKEME application 
// 
 
#ifndef __WAKEMEAPP__ 
#define __WAKEMEAPP__ 
 
#include "stdafx.h" 
#include  
#include "mailcheckdlg.h" 
 
///////////////////////////////////////////////////////////////////////////// 
// CWakemeApp: 
// See Wakeme.cpp for the implementation of this class 
// 
 
class CNewMailAdviseSink; 
class CWakemeApp 
{ 
public: 
	CWakemeApp(); 
	~CWakemeApp(); 
 
private:	 
	BOOL			m_fMAPIInitialized; 
	 
	LPMAPIFOLDER	m_lpIPMFolder; 
	LPMAPIFOLDER	m_lpInboxFolder;  
	LPMAPIFOLDER	m_lpOutboxFolder; 
	LPMAPIFOLDER	m_lpRootFolder; 
	LPMAPITABLE		m_lpRootHierarchyTable; 
	 
    BOOL			m_bNewMailNotify; 
	ULONG			m_ulNewMailConnection; 
 
    CNewMailAdviseSink *m_pNewMailSink; 
 
    HRESULT			RegisterForNewMail(); 
    HRESULT			UnregisterForNewMail(); 
	 
public: 
	LPMAPISESSION	m_pSession; 
	LPMDB			m_lpDefaultStore; 
	HRESULT			OpenMsgStore(); 
	HRESULT			QueryDefaultMsgStore(ULONG FAR *pcbEntryID, LPENTRYID FAR *ppEntryID); 
 
	CMailCheckDlg	dlg; 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
     
// Advise sink for new mail notifications 
class CNewMailAdviseSink : public IMAPIAdviseSink 
{ 
public: 
    ULONG			m_cRef; 
    CWakemeApp       *m_pParent; 
     
    CNewMailAdviseSink(CWakemeApp *pParent) { m_pParent = pParent; m_cRef = 1; } 
     
    STDMETHODIMP QueryInterface(REFIID riid,LPVOID FAR* ppvObj); 
    STDMETHODIMP_(ULONG) AddRef(); 
    STDMETHODIMP_(ULONG) Release(); 
    STDMETHODIMP_(ULONG) OnNotify(ULONG cNotif,LPNOTIFICATION lpNotifications); 
}; 
 
#endif // #ifndef __WAKEMEAPP__