Files
Work/proto/source/AdviseSink.hpp
2024-08-07 09:16:27 -04:00

78 lines
1.7 KiB
C++

#ifndef _COM_ADVISESINK_HPP_
#define _com_ADVISESINK_HPP_
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#ifndef _ATL_APARTMENT_THREADED
#define _ATL_APARTMENT_THREADED
#endif
#ifndef _COM_ATLBASE_HPP_
#include <com/atlbase.hpp>
#endif
#ifndef _COM_ATLMODULE_HPP_
#include <com/atlmod.hpp>
#endif
#ifndef _COM_ATLCOM_HPP_
#include <com/atlcom.hpp>
#endif
#ifndef _COM_COM_HPP_
#include <com/com.hpp>
#endif
#ifndef _COM_VARIANT_HPP_
#include <com/variant.hpp>
#endif
#ifndef _COM_RESULT_HPP_
#include <com/result.hpp>
#endif
// GENERIC CONNECTION POINT INTERFACE
// INHERIT FROM THIS CLASS, PASSING IN...
// 1) THE NAME OF THE CONNECTION POINT INTERFACE CLASS (FROM IDL FILE)
// 2) POINTER TO THE IID FOR THE CONNECTION POINT INTERFACE
// 3) POINTER TO THE LIBID FOR THE CONNECTION POINT INTERFACE
// THEN PROVIDE THE VIRTUAL FUNCTION(S) DESCRIBED IN THE IDL THAT THE CONNECTION POINT WILL CALL
// (IE)
// IDL CODE
// interface IImageNotify : IDispatch
// {
// [id(1), helpstring("method ImageNotify")]
// HRESULT ImageNotify(VARIANT *pVariant);
// };
// C++ CODE
// class ImageAdviseHandler : public AdviseSink<IImageNotify,&IID_IImageNotify,&LIBID_REMOTEPSEVENTLib>
// {
// ...
// virtual HRESULT ImageNotify(VARIANT *pVariant);
// ...
// }
template <class U,const IID *V,const GUID *W>
class AdviseSink :
public CComObjectRootEx<CComMultiThreadModel>,
public IDispatchImpl<U,V,W>
{
public:
AdviseSink(void);
virtual ~AdviseSink();
BEGIN_COM_MAP(AdviseSink)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(U)
END_COM_MAP()
private:
};
template <class U,const IID *V,const GUID *W>
inline
AdviseSink<U,V,W>::AdviseSink(void)
{
}
template <class U,const IID *V,const GUID *W>
inline
AdviseSink<U,V,W>::~AdviseSink()
{
}
#endif