Click here to Skip to main content
15,885,546 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 68.7K   2.4K   54  
Outlook add-in integration for Skype IM: Skype events, Outlook Skype ribbon, and more.
#ifndef StringMgr_H
#define StringMgr_H

    #define INVALID_STRING_LENGTH   ((size_t)-1)

    typedef struct StringMgr StringMgr;
    struct StringMgr {
        size_t (NDAPI *Length)(
            StringMgr   *This,
            LPCWSTR     psz
            );
        BOOL (NDAPI *LengthEx)(
            StringMgr   *This,
            LPCWSTR     psz, 
            size_t      cchMax, 
            size_t      *pcchLength
            );
        BOOL (NDAPI *Copy)(
            StringMgr   *This,
            LPWSTR      Dst, 
            size_t      cch, 
            LPCWSTR     Src
            );
        BOOL (NDAPI *Dup)(
            StringMgr   *This,
            LPWSTR      *Dst, 
            LPCWSTR     Src
            );
        BOOL (NDAPI *Append)(
            StringMgr   *This,
            LPWSTR      Dst, 
            size_t      cch, 
            LPCWSTR     Src
            );
        BOOL (NDAPI *FormatV)(
            StringMgr   *This,
            LPWSTR      Dst, 
            size_t      cch, 
            LPCWSTR     Fmt, 
            va_list     ap 
            );
        BOOL (NDAPIV *Format)(
            StringMgr   *This,
            LPWSTR      Dst, 
            size_t      cch, 
            LPCWSTR     Fmt, 
            ...
            );
        LPWSTR (NDAPI *StrTok)(
            StringMgr   *This, 
            LPWSTR      psz, 
            LPCWSTR     separators
            );
    };

    StringMgr*
    StringMgr_GetObject(
        VOID
        );

    //  macros
    #define StringMgr_Length(This, psz) \
        ((This->Length)((This), (psz)))
    #define StringMgr_LengthEx(This, psz, cchMax, pcchLength) \
        ((This->LengthEx)((This), (psz), (cchMax), (pcchLength)))
    #define StringMgr_Copy(This, Dst, cch, Src) \
        ((This->Copy)((This), (Dst), (cch), (Src)))
    #define StringMgr_Dup(This, Dst, Src) \
        ((This->Dup)((This), (Dst), (Src)))
    #define StringMgr_Append(This, Dst, cch, Src) \
        ((This->Append)((This), (Dst), (cch), (Src)))
    #define StringMgr_StrTok(This, psz, sep) \
        ((This->StrTok)((This), (psz), (sep)))
    #define StringMgr_FormatV(This, psz, cch, fmt, ap) \
        (This->FormatV((This), (psz), (cch), (fmt), (ap)))
    #define StringMgr_Format0(This, psz, cch, fmt) \
        (This->Format((This), (psz), (cch), (fmt)))
    #define StringMgr_Format1(This, psz, cch, fmt, Arg1) \
        (This->Format((This), (psz), (cch), (fmt), (Arg1)))
    #define StringMgr_Format2(This, psz, cch, fmt, Arg1, Arg2) \
        (This->Format((This), (psz), (cch), (fmt), (Arg1), (Arg2)))
    #define StringMgr_Format3(This, psz, cch, fmt, Arg1, Arg2, Arg3) \
        (This->Format((This), (psz), (cch), (fmt), (Arg1), (Arg2), (Arg3)))
    #define StringMgr_Format4(This, psz, cch, fmt, Arg1, Arg2, Arg3, Arg4) \
        (This->Format((This), (psz), (cch), (fmt), (Arg1), (Arg2), (Arg3), (Arg4)))
    #define StringMgr_Format5(This, psz, cch, fmt, Arg1, Arg2, Arg3, Arg4, Arg5) \
        (This->Format((This), (psz), (cch), (fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5)))

    //  string copy into a static string
    #define SzStringLength(sz) \
        StringMgr_Length(StringMgr_GetObject(), (sz))
    #define SzStringLengthEx(psz, cch, pcch) \
        StringMgr_Length(StringMgr_GetObject(), (psz), (cch), (pcch))
    #define SzStringCopy(sz, Src) \
        StringMgr_Copy(StringMgr_GetObject(), (sz), (_countof(sz)), (Src))
    #define SzStringAppend(sz, Src) \
        StringMgr_Append(StringMgr_GetObject(), (sz), (_countof(sz)), (Src))
    #define SzStringFormatV(sz, fmt, ap) \
        StringMgr_FormatV(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt), (ap))
    #define SzStringStrTok(psz, sep) \
        StringMgr_StrTok(StringMgr_GetObject(), (psz), (sep))

    #define PszStringLength(psz) \
        StringMgr_Length(StringMgr_GetObject(), (psz))
    #define PszStringLengthEx(psz, cch, pcch) \
        StringMgr_LengthEx(StringMgr_GetObject(), (psz), (cch), (pcch))
    #define PszStringCopy(psz, cch, Src) \
        StringMgr_Copy(StringMgr_GetObject(), (psz), (cch), (Src))
    #define PszStringDup(Dst, Src) \
        StringMgr_Dup(StringMgr_GetObject(), (Dst), (Src))
    #define PszStringAppend(psz, cch, Src) \
        StringMgr_Append(StringMgr_GetObject(), (psz), (cch), (Src))
    #define PszStringFormatV(psz, cch, fmt, ap) \
        StringMgr_FormatV(StringMgr_GetObject(), (psz), (cch), (fmt), (ap))
    #define PszStringStrTok(psz, sep) \
        StringMgr_StrTok(StringMgr_GetObject(), (psz), (sep))

    //  _countof strings (locals)
    #define SzStringFormat0(sz, fmt) \
        StringMgr_Format0(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt))
    #define SzStringFormat1(sz, fmt, Arg1) \
        StringMgr_Format1(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt), (Arg1))
    #define SzStringFormat2(sz, fmt, Arg1, Arg2) \
        StringMgr_Format2(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt), (Arg1), (Arg2))
    #define SzStringFormat3(sz, fmt, Arg1, Arg2, Arg3) \
        StringMgr_Format3(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt), (Arg1), (Arg2), (Arg3))
    #define SzStringFormat4(sz, fmt, Arg1, Arg2, Arg3, Arg4) \
        StringMgr_Format4(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt), (Arg1), (Arg2), (Arg3), (Arg4))
    #define SzStringFormat5(sz, fmt, Arg1, Arg2, Arg3, Arg4, Arg5) \
        StringMgr_Format5(StringMgr_GetObject(), (sz), (_countof(sz)), (fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))

    //  non-_countof strings (pointers)
    #define PszStringFormat0(psz, cch, fmt) \
        StringMgr_Format0(StringMgr_GetObject(), (psz), (cch), (fmt))
    #define PszStringFormat1(psz, cch, fmt, Arg1) \
        StringMgr_Format1(StringMgr_GetObject(), (psz), (cch), (fmt), (Arg1))
    #define PszStringFormat2(psz, cch, fmt, Arg1, Arg2) \
        StringMgr_Format2(StringMgr_GetObject(), (psz), (cch), (fmt), (Arg1), (Arg2))
    #define PszStringFormat3(psz, cch, fmt, Arg1, Arg2, Arg3) \
        StringMgr_Format3(StringMgr_GetObject(), (psz), (cch), (fmt), (Arg1), (Arg2), (Arg3))
    #define PszStringFormat4(psz, cch, fmt, Arg1, Arg2, Arg3, Arg4) \
        StringMgr_Format4(StringMgr_GetObject(), (psz), (cch), (fmt), (Arg1), (Arg2), (Arg3), (Arg4))
    #define PszStringFormat5(psz, cch, fmt, Arg1, Arg2, Arg3, Arg4, Arg5) \
        StringMgr_Format5(StringMgr_GetObject(), (psz), (cch), (fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))

#endif  //  StringMgr_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