RTC problem
-
I run the program by Microsoft Visual Studio 2005 on the Windows® XP operating system. I try to run the basic program of RTC. There is no compile error, but there is a run-time error. ==> hr = pIDispatch->QueryInterface (IID_IRTCSessionStateChangeEvent,reinterpret_cast (&pISessionState)); The error message is __vfptr = CXX0030: Error: expression cannot be evaluated. The code is followed. Can somebody tell me where is the problem?
#include "stdafx.h" #define _WIN32_DCOM #include #include #include #include #include #include #include #include #pragma comment(lib, "ole32.lib") #pragma comment(lib, "Uuid.lib") using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HRESULT hr = S_OK; CoInitializeEx(NULL,COINIT_APARTMENTTHREADED); IRTCClient *pIRTCClient; hr = CoCreateInstance( CLSID_RTCClient, NULL, CLSCTX_INPROC_SERVER, IID_IRTCClient, reinterpret_cast (&pIRTCClient) ); hr = pIRTCClient->Initialize(); long lEventMask; lEventMask = RTCEF_ALL; hr = pIRTCClient->put_EventFilter(lEventMask); DWORD dwEventCookie; IUnknown *pUnknown = NULL; IConnectionPointContainer *pCPC = NULL; IConnectionPoint *pCP = NULL; hr = pIRTCClient->QueryInterface( IID_IUnknown, reinterpret_cast (&pUnknown) ); hr = pIRTCClient->QueryInterface( IID_IConnectionPointContainer, reinterpret_cast (&pCPC) ); hr = pCPC->FindConnectionPoint( IID_IRTCEventNotification, &pCP ); hr = pCP->Advise( pUnknown, &dwEventCookie ); pCP->Release(); pCPC->Release(); pUnknown->Release(); hr = pIRTCClient->put_ListenForIncomingSessions( RTCLM_BOTH ); BSTR bstrLocalURI = NULL; BSTR bstrDestURI = NULL; RTC_SESSION_TYPE SessionType; IRTCSession *pIRTCSession = NULL; IRTCProfile *pIRTCProfile = NULL; SessionType = RTCST_PC_TO_PC ; // Specify session type if(SessionType == RTCST_PHONE_TO_PHONE){bstrLocalURI = SysAllocString(_T("tel:+14255550123"));} bstrDestURI = SysAllocString(_T("sip:22500@163.22.20.154")); hr = pIRTCClient->CreateSession( SessionType, bstrLocalURI, pIRTCProfile,RTCCS_FORCE_PROFILE,&pIRTCSession ); IRTCParticipant *pIRTCParticipant; hr = pIRTCSession->AddParticipant( bstrDestURI, NULL, &pIRTCParticipant ); hr = pIRTCSession->Termin