Click here to Skip to main content
15,897,704 members
Articles / Desktop Programming / Win32

Outlook add-in integrating Skype

Rate me:
Please Sign up or sign in to vote.
4.93/5 (32 votes)
28 May 2015CPOL20 min read 69K   2.4K   54  
Outlook add-in integration for Skype IM: Skype events, Outlook Skype ribbon, and more.
#ifndef OutlookUtils_H
#define OutlookUtils_H

    typedef enum enOutlookVersion {
        OUTLOOK_MAJOR_VERSION_UNKNOWN  = -1,
        OUTLOOK_MAJOR_VERSION_2000     =  9,
        OUTLOOK_MAJOR_VERSION_2002     = 10,
        OUTLOOK_MAJOR_VERSION_2003     = 11,
        OUTLOOK_MAJOR_VERSION_2007     = 12,
        OUTLOOK_MAJOR_VERSION_2010     = 14
    } enOutlookVersion;

    typedef struct OutlookMgr OutlookMgr;

    typedef struct OutlookMgrVtbl {
        VOID (NDAPI *Cleanup)(
            OutlookMgr          *This
            );
        BOOL (NDAPI *ReadMajorVersion)(
            OutlookMgr          *This,
            IDispatch           *Application
            );
        BOOL (NDAPI *ReadAddinFastShutdownBehavior)(
            OutlookMgr          *This, 
            IDispatch           *Application
            );
        BOOL (NDAPI *GetMajorVersion)(
            OutlookMgr          *This, 
            LONG                *MajorVersion
            );
        BOOL (NDAPI *GetAddinFastShutdown)(
            OutlookMgr          *This, 
            BOOL                *AddinFastShutdown
            );
        BOOL (NDAPI *GetProp_IDispatch)(
            OutlookMgr          *This, 
            IDispatch           *Object, 
            LPCWSTR             PropName, 
            IDispatch           **Property
            );
        HRESULT (NDAPI *Unadvise)(
            OutlookMgr          *This, 
            IDispatch           *Object, 
            const IID           *EventDIID, 
            DWORD               *CookieID
            );
        HRESULT (NDAPI *FindEnumMemberByName)(
            OutlookMgr          *This, 
            LPCWSTR             EnumName, 
            LPCWSTR             MemberName, 
            int                 *Value
            );
    } OutlookMgrVtbl;

    typedef struct OLEnumMember OLEnumMember;
    typedef struct OLEnumMember {
        LPWSTR  Name;
        int     Value;
        BOOL    valid;

        OLEnumMember* Next;
    } OLEnumMember;

    typedef struct OLEnumDesc OLEnumDesc;
    typedef struct OLEnumDesc {
        LPWSTR          Name;
        OLEnumMember    *Members;

        OLEnumDesc      *Next;
    } OLEnumDesc;

    struct OutlookMgr {
        const struct OutlookMgrVtbl    *lpVtbl;

        LONG        MajorVersion;
        BOOL        AddinFastShutdown;

        OLEnumDesc  *OutlookEnums;
    };

    OutlookMgr*
    OutlookMgr_GetObject(
        VOID
        );

    //  C macros to avoid lpVtbl
    #define OutlookMgr_Cleanup(This) \
        (((This)->lpVtbl)->Cleanup(This))
    #define OutlookMgr_ReadMajorVersion(This, Application) \
        (((This)->lpVtbl)->ReadMajorVersion((This), (Application)))
    #define OutlookMgr_ReadAddinFastShutdownBehavior(This, Application) \
        (((This)->lpVtbl)->ReadAddinFastShutdownBehavior((This), (Application)))
    #define OutlookMgr_GetMajorVersion(This, MajorVersion) \
        (((This)->lpVtbl)->GetMajorVersion((This), (MajorVersion)))
    #define OutlookMgr_GetAddinFastShutdown(This, AddinFastShutdown) \
        (((This)->lpVtbl)->GetAddinFastShutdown((This), (AddinFastShutdown)))
    #define OutlookMgr_GetProp_IDispatch(This, Object, PropName, Property) \
        (((This)->lpVtbl)->GetProp_IDispatch((This), (Object), (PropName), (Property)))
    #define OutlookMgr_Unadvise(This, Object, EventDIID, CookieID) \
        (((This)->lpVtbl)->Unadvise((This), (Object), (EventDIID), (CookieID)))
    #define OutlookMgr_FindEnumMemberByName(This, EnumName, MemberName, Value) \
        (((This)->lpVtbl)->FindEnumMemberByName((This), (EnumName), (MemberName), (Value)))

    #define Outlook_Cleanup() \
        OutlookMgr_Cleanup(OutlookMgr_GetObject())
    #define Outlook_ReadMajorVersion(Application) \
        OutlookMgr_ReadMajorVersion(OutlookMgr_GetObject(), (Application))
    #define Outlook_ReadAddinFastShutdownBehavior(Application) \
        OutlookMgr_ReadAddinFastShutdownBehavior(OutlookMgr_GetObject(), (Application))
    #define Outlook_GetMajorVersion(MajorVersion) \
        OutlookMgr_GetMajorVersion(OutlookMgr_GetObject(), (MajorVersion))
    #define Outlook_GetAddinFastShutdown(AddinFastShutdown) \
        OutlookMgr_GetAddinFastShutdown(OutlookMgr_GetObject(), (AddinFastShutdown))
    #define Outlook_GetProp_IDispatch(Object, PropName, Property) \
        OutlookMgr_GetProp_IDispatch(OutlookMgr_GetObject(), (Object), (PropName), (Property))
    #define Outlook_Unadvise(Object, EventDIID, CookieID) \
        OutlookMgr_Unadvise(OutlookMgr_GetObject(), (Object), (EventDIID), (CookieID))
    #define Outlook_FindEnumMemberByName(EnumName, MemberName, Value) \
        OutlookMgr_FindEnumMemberByName(OutlookMgr_GetObject(), (EnumName), (MemberName), (Value))

#endif  //  OutlookUtils_H

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader BitDefender
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions