Quell
November 21st, 2007, 04:08 PM
Hey.
I have the following code:
Header;
#pragma once
#include <cemapi.h>
#include <mapiutil.h>
#include <mapidefs.h>
class CIMAPIAdviseSink : public IMAPIAdviseSink
{
public:
CIMAPIAdviseSink(void);
virtual ~CIMAPIAdviseSink();
STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP_(ULONG) OnNotify (ULONG cNotify, LPNOTIFICATION lpNotifications);
private :
LONG m_cRef;
};
Source
#include "StdAfx.h"
#include "CustomImapi.h"
CIMAPIAdviseSink::CIMAPIAdviseSink(void)
{
}
CIMAPIAdviseSink::~CIMAPIAdviseSink()
{
};
STDMETHODIMP CIMAPIAdviseSink::QueryInterface(REFIID riid, LPVOID * ppvObj)
{
*ppvObj = 0;
if (riid == IID_IMAPIAdviseSink || riid == IID_IUnknown)
{
*ppvObj = (LPVOID)this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) CIMAPIAdviseSink::AddRef()
{
LONG lCount = InterlockedIncrement(&m_cRef);
return lCount;
};
STDMETHODIMP_(ULONG) CIMAPIAdviseSink::Release()
{
LONG lCount = InterlockedDecrement(&m_cRef);
if (!lCount) delete this;
return lCount;
};
STDMETHODIMP_(ULONG) CIMAPIAdviseSink::OnNotify (ULONG cNotify, LPNOTIFICATION lpNotifications)
{
HRESULT hRes = S_OK;
try
{
for (ULONG i=0 ; i<cNotify ; i++)
{
hRes = S_OK;
if (fnevNewMail == lpNotifications[i].ulEventType)
{
}
else if (fnevTableModified == lpNotifications[i].ulEventType)
{
switch(lpNotifications[i].info.tab.ulTableEvent)
{
case(TABLE_ERROR):
case(TABLE_CHANGED):
case(TABLE_RELOAD):
//EC_H((HRESULT)::SendMessage(m_hWndParent,WM_MFCMAPI_REFRESHTABLE,(WPARAM) m_hTreeParent,0));
break;
case(TABLE_ROW_ADDED):
/*EC_H((HRESULT)::SendMessage(
m_hWndParent,
WM_MFCMAPI_ADDITEM,
(WPARAM) &lpNotifications[i].info.tab,
(LPARAM) m_hTreeParent));*/
break;
case(TABLE_ROW_DELETED):
/*EC_H((HRESULT)::SendMessage(
m_hWndParent,
WM_MFCMAPI_DELETEITEM,
(WPARAM) &lpNotifications[i].info.tab,
(LPARAM) m_hTreeParent));*/
break;
case(TABLE_ROW_MODIFIED):
/*EC_H((HRESULT)::SendMessage(
m_hWndParent,
WM_MFCMAPI_MODIFYITEM,
(WPARAM) &lpNotifications[i].info.tab,
(LPARAM) m_hTreeParent));*/
break;
}
}
}
}
catch(...)
{
/*ErrDialog(__FILE__,__LINE__,
_T("Exception encountered in CAdviseSink."));*/
}
return 0;
}
When i attempt to compile it i get:
error LNK2001: unresolved external symbol IID_IMAPIAdviseSink
Any ideas why? I get go to the definition of the GUID easily.
I included cemapi.lib in the linker options (Smart Device Deploymnet), but i got no idea why i am getting that error.
Thx in advance.
I have the following code:
Header;
#pragma once
#include <cemapi.h>
#include <mapiutil.h>
#include <mapidefs.h>
class CIMAPIAdviseSink : public IMAPIAdviseSink
{
public:
CIMAPIAdviseSink(void);
virtual ~CIMAPIAdviseSink();
STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP_(ULONG) OnNotify (ULONG cNotify, LPNOTIFICATION lpNotifications);
private :
LONG m_cRef;
};
Source
#include "StdAfx.h"
#include "CustomImapi.h"
CIMAPIAdviseSink::CIMAPIAdviseSink(void)
{
}
CIMAPIAdviseSink::~CIMAPIAdviseSink()
{
};
STDMETHODIMP CIMAPIAdviseSink::QueryInterface(REFIID riid, LPVOID * ppvObj)
{
*ppvObj = 0;
if (riid == IID_IMAPIAdviseSink || riid == IID_IUnknown)
{
*ppvObj = (LPVOID)this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) CIMAPIAdviseSink::AddRef()
{
LONG lCount = InterlockedIncrement(&m_cRef);
return lCount;
};
STDMETHODIMP_(ULONG) CIMAPIAdviseSink::Release()
{
LONG lCount = InterlockedDecrement(&m_cRef);
if (!lCount) delete this;
return lCount;
};
STDMETHODIMP_(ULONG) CIMAPIAdviseSink::OnNotify (ULONG cNotify, LPNOTIFICATION lpNotifications)
{
HRESULT hRes = S_OK;
try
{
for (ULONG i=0 ; i<cNotify ; i++)
{
hRes = S_OK;
if (fnevNewMail == lpNotifications[i].ulEventType)
{
}
else if (fnevTableModified == lpNotifications[i].ulEventType)
{
switch(lpNotifications[i].info.tab.ulTableEvent)
{
case(TABLE_ERROR):
case(TABLE_CHANGED):
case(TABLE_RELOAD):
//EC_H((HRESULT)::SendMessage(m_hWndParent,WM_MFCMAPI_REFRESHTABLE,(WPARAM) m_hTreeParent,0));
break;
case(TABLE_ROW_ADDED):
/*EC_H((HRESULT)::SendMessage(
m_hWndParent,
WM_MFCMAPI_ADDITEM,
(WPARAM) &lpNotifications[i].info.tab,
(LPARAM) m_hTreeParent));*/
break;
case(TABLE_ROW_DELETED):
/*EC_H((HRESULT)::SendMessage(
m_hWndParent,
WM_MFCMAPI_DELETEITEM,
(WPARAM) &lpNotifications[i].info.tab,
(LPARAM) m_hTreeParent));*/
break;
case(TABLE_ROW_MODIFIED):
/*EC_H((HRESULT)::SendMessage(
m_hWndParent,
WM_MFCMAPI_MODIFYITEM,
(WPARAM) &lpNotifications[i].info.tab,
(LPARAM) m_hTreeParent));*/
break;
}
}
}
}
catch(...)
{
/*ErrDialog(__FILE__,__LINE__,
_T("Exception encountered in CAdviseSink."));*/
}
return 0;
}
When i attempt to compile it i get:
error LNK2001: unresolved external symbol IID_IMAPIAdviseSink
Any ideas why? I get go to the definition of the GUID easily.
I included cemapi.lib in the linker options (Smart Device Deploymnet), but i got no idea why i am getting that error.
Thx in advance.