Re: Как зарегестрировать TAPI - событие?
От: dubina  
Дата: 21.12.02 21:32
Оценка:
Здравствуйте, Albatross, Вы писали:

A>Например, вызов на модем.

A>В MSDN по этому поводу написана какая-то чушь

A>Register Events

A>The following code snippets demonstrate implementation of a simple event handler, registration of the main TAPI event interface, setting of the event filter, and registration for call notifications.

A>Before using this code snippet, you must perform the operations in Initialize TAPI and Select an Address.


A>Note This snippet does not have the error checking and releases appropriate for real code.


A>C++ Code Snippets [C++]

A>//
A>// Snippet 1: Implement a simple event handler.
A>//
A>HRESULT STDMETHODCALLTYPE
A>CTAPIEventNotification::Event(
A> TAPI_EVENT TapiEvent,
A> IDispatch * pEvent
A> )
A>{
A> // AddRef the event so it doesn't go away.
A> pEvent->AddRef();

A> // Post a message to our own UI thread.

A> PostMessage(
A> ghDlg,
A> WM_PRIVATETAPIEVENT,
A> (WPARAM) TapiEvent,
A> (LPARAM) pEvent
A> );

A> return S_OK;

A>}

A>//

A>// Snippet 2: Register the event interface.
A>//
A>long gulAdvise; // Globally declared
A>IConnectionPointContainer * pCPC;
A>IConnectionPoint * pCP;
A>IUnknown * gUnk;

A>// Get the connection point container

A>// interface pointer from the TAPI object.
gpTapi->>QueryInterface(
A> IID_IConnectionPointContainer,
A> (void **)&pCPC
A> );

A>// Get the ITTAPIEventNOtification interface

A>// pointer from the container.
pCPC->>FindConnectionPoint(
A> IID_ITTAPIEventNotification,
A> &pCP
A> );

pCPC->>Release();


pTAPIEventNotification->>QueryInterface(
A> IID_IUnknown,
A> (void **)&pUnk
A> );

A>// Call the advise method to give TAPI

A>// the IUnknown pointer for the event handler.
pCP->>Advise(
A> pUnk,
A> (ULONG *)&gulAdvise
A> );

pCP->>Release();


A>//

A>// Snippet 3: Set the event filter.
A>//
A>// Assume we are interested
A>// only in call-related events.
gpTapi->>put_EventFilter(
A> TE_CALLNOTIFICATION | TE_CALLSTATE | TE_CALLMEDIA
A> );

A>//

A>// Snippet 4: Register an address with TAPI
A>// for call notifications. Assume we are interested
A>// in video and audio calls, and that pAddress
A>// is a pointer to the ITAddress interface of
A>// an address that can handle both media types.

A>long glRegister; // Globally declared


gpTapi->>RegisterCallNotifications(
A> pAddress,
A> VARIANT_TRUE, // monitor privileges
A> VARIANT_TRUE, // owner privileges
A> TAPIMEDIATYPE_AUDIO|TAPIMEDIATYPE_VIDEO,
A> gulAdvise, // As returned by Advise
A> &glRegister
A> );

A>


A>


A>первые строчки этого — вообще чушь полная...

A>кроме того, такого класса вообще нет — я имею в виду CTAPIEventNotification

A>

A>что делать-то?

В общем не совсем чушь, если до сих пор не разобрался — сообщи
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.