Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Building an Office2K COM addin with VC++/ATL

, 30 Apr 2003
This article shows how to program an Outlook2000/2K+ COM addin using a pure ATL COM object.
outlookaddin.zip
OutlookAddinps.mk
OutlookAddin.dsp
OutlookAddin.dsw
Addin.rgs
LitePage.rgs
Page.rgs
PropPage.rgs
OutlookAddin.tlb
bitmap1.bmp
litepage.bmp
proppage.bmp
OutlookAddin.def
OutlookAddinps.def
OutlookAddin.plg
/* this ALWAYS GENERATED file contains the definitions for the interfaces */


/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Feb 10 16:49:42 2002
 */
/* Compiler settings for C:\CODE\OFFICEADDIN\OutlookAddin\OutlookAddin.idl:
    Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
    error checks: allocation ref bounds_check enum stub_data 
*/
//@@MIDL_FILE_HEADING(  )


/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__

#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/

#ifndef __OutlookAddin_h__
#define __OutlookAddin_h__

#ifdef __cplusplus
extern "C"{
#endif 

/* Forward Declarations */ 

#ifndef __IAddin_FWD_DEFINED__
#define __IAddin_FWD_DEFINED__
typedef interface IAddin IAddin;
#endif 	/* __IAddin_FWD_DEFINED__ */


#ifndef __IPropPage_FWD_DEFINED__
#define __IPropPage_FWD_DEFINED__
typedef interface IPropPage IPropPage;
#endif 	/* __IPropPage_FWD_DEFINED__ */


#ifndef __ILitePage_FWD_DEFINED__
#define __ILitePage_FWD_DEFINED__
typedef interface ILitePage ILitePage;
#endif 	/* __ILitePage_FWD_DEFINED__ */


#ifndef __Addin_FWD_DEFINED__
#define __Addin_FWD_DEFINED__

#ifdef __cplusplus
typedef class Addin Addin;
#else
typedef struct Addin Addin;
#endif /* __cplusplus */

#endif 	/* __Addin_FWD_DEFINED__ */


#ifndef __PropPage_FWD_DEFINED__
#define __PropPage_FWD_DEFINED__

#ifdef __cplusplus
typedef class PropPage PropPage;
#else
typedef struct PropPage PropPage;
#endif /* __cplusplus */

#endif 	/* __PropPage_FWD_DEFINED__ */


#ifndef __LitePage_FWD_DEFINED__
#define __LitePage_FWD_DEFINED__

#ifdef __cplusplus
typedef class LitePage LitePage;
#else
typedef struct LitePage LitePage;
#endif /* __cplusplus */

#endif 	/* __LitePage_FWD_DEFINED__ */


/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"

void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * ); 

#ifndef __IAddin_INTERFACE_DEFINED__
#define __IAddin_INTERFACE_DEFINED__

/* interface IAddin */
/* [unique][helpstring][dual][uuid][object] */ 


EXTERN_C const IID IID_IAddin;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("F8608145-BB5A-4A5A-AE7E-244C6E028093")
    IAddin : public IDispatch
    {
    public:
    };
    
#else 	/* C style interface */

    typedef struct IAddinVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( 
            IAddin __RPC_FAR * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
        
        ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( 
            IAddin __RPC_FAR * This);
        
        ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( 
            IAddin __RPC_FAR * This);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( 
            IAddin __RPC_FAR * This,
            /* [out] */ UINT __RPC_FAR *pctinfo);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( 
            IAddin __RPC_FAR * This,
            /* [in] */ UINT iTInfo,
            /* [in] */ LCID lcid,
            /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( 
            IAddin __RPC_FAR * This,
            /* [in] */ REFIID riid,
            /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
            /* [in] */ UINT cNames,
            /* [in] */ LCID lcid,
            /* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( 
            IAddin __RPC_FAR * This,
            /* [in] */ DISPID dispIdMember,
            /* [in] */ REFIID riid,
            /* [in] */ LCID lcid,
            /* [in] */ WORD wFlags,
            /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
            /* [out] */ VARIANT __RPC_FAR *pVarResult,
            /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
            /* [out] */ UINT __RPC_FAR *puArgErr);
        
        END_INTERFACE
    } IAddinVtbl;

    interface IAddin
    {
        CONST_VTBL struct IAddinVtbl __RPC_FAR *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IAddin_QueryInterface(This,riid,ppvObject)	\
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define IAddin_AddRef(This)	\
    (This)->lpVtbl -> AddRef(This)

#define IAddin_Release(This)	\
    (This)->lpVtbl -> Release(This)


#define IAddin_GetTypeInfoCount(This,pctinfo)	\
    (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)

#define IAddin_GetTypeInfo(This,iTInfo,lcid,ppTInfo)	\
    (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)

#define IAddin_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)	\
    (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)

#define IAddin_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)	\
    (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)


#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __IAddin_INTERFACE_DEFINED__ */


#ifndef __IPropPage_INTERFACE_DEFINED__
#define __IPropPage_INTERFACE_DEFINED__

/* interface IPropPage */
/* [unique][helpstring][dual][uuid][object] */ 


EXTERN_C const IID IID_IPropPage;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("C76C5E4D-FDFF-4756-B925-B29817CE6288")
    IPropPage : public IDispatch
    {
    public:
    };
    
#else 	/* C style interface */

    typedef struct IPropPageVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( 
            IPropPage __RPC_FAR * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
        
        ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( 
            IPropPage __RPC_FAR * This);
        
        ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( 
            IPropPage __RPC_FAR * This);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( 
            IPropPage __RPC_FAR * This,
            /* [out] */ UINT __RPC_FAR *pctinfo);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( 
            IPropPage __RPC_FAR * This,
            /* [in] */ UINT iTInfo,
            /* [in] */ LCID lcid,
            /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( 
            IPropPage __RPC_FAR * This,
            /* [in] */ REFIID riid,
            /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
            /* [in] */ UINT cNames,
            /* [in] */ LCID lcid,
            /* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( 
            IPropPage __RPC_FAR * This,
            /* [in] */ DISPID dispIdMember,
            /* [in] */ REFIID riid,
            /* [in] */ LCID lcid,
            /* [in] */ WORD wFlags,
            /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
            /* [out] */ VARIANT __RPC_FAR *pVarResult,
            /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
            /* [out] */ UINT __RPC_FAR *puArgErr);
        
        END_INTERFACE
    } IPropPageVtbl;

    interface IPropPage
    {
        CONST_VTBL struct IPropPageVtbl __RPC_FAR *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IPropPage_QueryInterface(This,riid,ppvObject)	\
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define IPropPage_AddRef(This)	\
    (This)->lpVtbl -> AddRef(This)

#define IPropPage_Release(This)	\
    (This)->lpVtbl -> Release(This)


#define IPropPage_GetTypeInfoCount(This,pctinfo)	\
    (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)

#define IPropPage_GetTypeInfo(This,iTInfo,lcid,ppTInfo)	\
    (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)

#define IPropPage_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)	\
    (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)

#define IPropPage_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)	\
    (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)


#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __IPropPage_INTERFACE_DEFINED__ */


#ifndef __ILitePage_INTERFACE_DEFINED__
#define __ILitePage_INTERFACE_DEFINED__

/* interface ILitePage */
/* [unique][helpstring][dual][uuid][object] */ 


EXTERN_C const IID IID_ILitePage;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("067CA4E2-556E-47DD-9EFA-ADAABB2C0D95")
    ILitePage : public IDispatch
    {
    public:
    };
    
#else 	/* C style interface */

    typedef struct ILitePageVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( 
            ILitePage __RPC_FAR * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
        
        ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( 
            ILitePage __RPC_FAR * This);
        
        ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( 
            ILitePage __RPC_FAR * This);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( 
            ILitePage __RPC_FAR * This,
            /* [out] */ UINT __RPC_FAR *pctinfo);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( 
            ILitePage __RPC_FAR * This,
            /* [in] */ UINT iTInfo,
            /* [in] */ LCID lcid,
            /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
        
        HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( 
            ILitePage __RPC_FAR * This,
            /* [in] */ REFIID riid,
            /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
            /* [in] */ UINT cNames,
            /* [in] */ LCID lcid,
            /* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( 
            ILitePage __RPC_FAR * This,
            /* [in] */ DISPID dispIdMember,
            /* [in] */ REFIID riid,
            /* [in] */ LCID lcid,
            /* [in] */ WORD wFlags,
            /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
            /* [out] */ VARIANT __RPC_FAR *pVarResult,
            /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
            /* [out] */ UINT __RPC_FAR *puArgErr);
        
        END_INTERFACE
    } ILitePageVtbl;

    interface ILitePage
    {
        CONST_VTBL struct ILitePageVtbl __RPC_FAR *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ILitePage_QueryInterface(This,riid,ppvObject)	\
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define ILitePage_AddRef(This)	\
    (This)->lpVtbl -> AddRef(This)

#define ILitePage_Release(This)	\
    (This)->lpVtbl -> Release(This)


#define ILitePage_GetTypeInfoCount(This,pctinfo)	\
    (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)

#define ILitePage_GetTypeInfo(This,iTInfo,lcid,ppTInfo)	\
    (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)

#define ILitePage_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)	\
    (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)

#define ILitePage_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)	\
    (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)


#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ILitePage_INTERFACE_DEFINED__ */



#ifndef __OUTLOOKADDINLib_LIBRARY_DEFINED__
#define __OUTLOOKADDINLib_LIBRARY_DEFINED__

/* library OUTLOOKADDINLib */
/* [helpstring][version][uuid] */ 


EXTERN_C const IID LIBID_OUTLOOKADDINLib;

EXTERN_C const CLSID CLSID_Addin;

#ifdef __cplusplus

class DECLSPEC_UUID("C704648D-6030-47E9-ADBA-1E13B6A784AE")
Addin;
#endif

EXTERN_C const CLSID CLSID_PropPage;

#ifdef __cplusplus

class DECLSPEC_UUID("BE1A7148-9F02-40F9-AB5A-5AD4E7D11E62")
PropPage;
#endif

EXTERN_C const CLSID CLSID_LitePage;

#ifdef __cplusplus

class DECLSPEC_UUID("21881BCB-9F1E-42CE-BD5B-ED0E13379A54")
LitePage;
#endif
#endif /* __OUTLOOKADDINLib_LIBRARY_DEFINED__ */

/* Additional Prototypes for ALL interfaces */

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Amit Dey
Web Developer
India India
Amit Dey is a freelance programmer from Bangalore,India. Chiefly programming VC++/MFC, ATL/COM and PocketPC and Palm platforms. Apart from programming and CP, he is a self-taught guitar and keyboard player.
 
He can be contacted at visualcdev@hotmail.com
 

| Advertise | Privacy | Mobile
Web01 | 2.8.140921.1 | Last Updated 1 May 2003
Article Copyright 2002 by Amit Dey
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid