Click here to Skip to main content
15,891,372 members
Articles / Desktop Programming / MFC

VideoIPPhone

Rate me:
Please Sign up or sign in to vote.
4.29/5 (7 votes)
12 Mar 2005CPOL 74.4K   8K   72  
VOIP using Microsoft TAPI
/*++

Copyright (c) 1999 - 2000 Microsoft Corporation.  All Rights Reserved.

Module Name:
    callnot.h

Abstract:
    
    Declaration of the CTAPIEventNotification object

--*/

#ifndef __TAPIEventNotification_H__
#define __TAPIEventNotification_H__

#include <tapi3.h>
#include <strmif.h>
#include <control.h>

extern ITBasicCallControl * g_pCall;
extern HWND g_hDlg;
extern BSTR g_bstrVideo;
extern BOOL g_fAutoAnswer;

enum {
	VWP_LEFT = 20,
	VWP_TOP = 100
};

void DoMessage(LPWSTR pszMessage);
HRESULT OnTapiEvent(TAPI_EVENT TapiEvent,IDispatch * pEvent);
void HostWindow(IVideoWindow *pVideoWindow,int iWhere);
HRESULT GetVideoRenderTerminalFromStreamEvent(ITCallMediaEvent  * pCallMediaEvent,ITTerminal ** ppTerminal,BOOL * pfRenderStream);
HRESULT OnTapiEvent(TAPI_EVENT TapiEvent,IDispatch * pEvent);

/////////////////////////////////////////////////////////////////////////////
// CTAPIEventNotification
class CTAPIEventNotification : public ITTAPIEventNotification
{
private:
    LONG       m_dwRefCount;
public:
    // CTAPIEventNotification implements ITTAPIEventNotification
    //  Declare ITTAPIEventNotification methods here
    HRESULT STDMETHODCALLTYPE Event(TAPI_EVENT TapiEvent,IDispatch * pEvent);
    
// other COM stuff:
public:

    //
    // constructor
    //

    CTAPIEventNotification()
    {
        m_dwRefCount = 1;
    }


    //
    // destructor
    //

    ~CTAPIEventNotification()
    {
    }

    // IUnknown implementation
	HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
    {
        if (iid == IID_ITTAPIEventNotification)
        {
            AddRef();
            *ppvObject = (void *)this;
            return S_OK;
        }

        if (iid == IID_IUnknown)
        {
            AddRef();
            *ppvObject = (void *)this;
            return S_OK;
        }

        return E_NOINTERFACE;
    }

    //
    // reference counting needs to be thread safe
    //
    
    ULONG STDMETHODCALLTYPE AddRef()
    {
        ULONG l = InterlockedIncrement(&m_dwRefCount);
        return l;
    }
    
	ULONG STDMETHODCALLTYPE Release()
    {
        ULONG l = InterlockedDecrement(&m_dwRefCount);

        if ( 0 == l)
        {
            delete this;
        }
        
        return l;
    }


};

#endif //__TAPIEventNotification_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
Software Developer interpay
Korea (Republic of) Korea (Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions