Click here to Skip to main content
15,897,187 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.
#include "Sdk.h"
#include "VariantUtils.h"

HRESULT
Variant_SetBool(
    VARIANT     *Variant, 
    BOOL        Value
) {
    if(Variant == NULL) {
        return E_POINTER;
    }

    V_VT(Variant)   = VT_BOOL;
    V_BOOL(Variant) = Value ? VARIANT_TRUE : VARIANT_FALSE;

    return S_OK;
}

HRESULT
Variant_SetLong(
    VARIANT     *Variant, 
    LONG        Value
) {
    if(Variant == NULL) {
        return E_POINTER;
    }

    V_VT(Variant) = VT_I4;
    V_I4(Variant) = Value;

    return S_OK;
}

HRESULT
Variant_SetString(
    VARIANT     *Variant, 
    LPCWSTR     Value
) {
    BSTR bstr = NULL;

    if(Variant == NULL) {
        return E_POINTER;
    }
    if(Value == NULL) {
        return E_INVALIDARG;
    }

    bstr = SysAllocString(Value);
    if(bstr == NULL) {
        return E_OUTOFMEMORY;
    }

    V_VT(Variant)   = VT_BSTR;
    V_BSTR(Variant) = bstr;

    return S_OK;
}

HRESULT
Variant_SetDispatch(
    VARIANT     *Variant, 
    IDispatch   *Value
) {
    if(Variant == NULL) {
        return E_POINTER;
    }

    V_VT(Variant) = VT_DISPATCH;
    if(Value == NULL) {
        V_DISPATCH(Variant) = NULL;
    }
    else {
        IDispatch_QueryInterface(Value, 
                                 &IID_IDispatch, 
                                 (void **)&(V_DISPATCH(Variant))
                                );
    }
    return S_OK;
}

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