電話和位址裝置特定事件
下列程式碼範例說明位址和電話裝置事件的事件處理常式。 每個事件的程式碼會示範如何建立事件介面,以及如何擷取事件資料。
HRESULT STDMETHODCALLTYPE CMyEventNotification::Event(
TAPI_EVENT TapiEvent,
IDispatch * pEvent
)
{
HRESULT hr = S_OK;
//...
switch (TapiEvent)
{
case TE_ADDRESSDEVSPECIFIC:
{
ITAddressDeviceSpecificEvent* pITADSEvent = NULL;
hr = pEvent->QueryInterface(
IID_ITAddressDeviceSpecificEvent,
(void **)(&pITADSEvent) );
// If (hr != S_OK) process the error here...
// Retrieve data received from the TSP.
long lParam1=0;
hr = pITADSEvent->get_lParam1(&lParam1);
// If (hr != S_OK) process the error here...
long lParam2=0;
hr = pITADSEvent->get_lParam2(&lParam2);
// If (hr != S_OK) process the error here...
long lParam3=0;
hr = pITADSEvent->get_lParam3(&lParam3);
// If (hr !=S_OK) process the error here...
// Process the data here.
// ...
pITADSEvent->Release();
break;
}
case TE_PHONEDEVSPECIFIC:
{
ITPhoneDeviceSpecificEvent* pITPhEvent = NULL;
hr = pEvent->QueryInterface(
IID_ITPhoneDeviceSpecificEvent,
(void **)(&pITPhEvent) );
// If (hr != S_OK) process the error here...
// Retrieve data received from the TSP.
long lParam1=0;
hr = pITPhEvent->get_lParam1(&lParam1);
// If (hr != S_OK) process the error here...
long lParam2=0;
hr = pITPhEvent->get_lParam2(&lParam2);
// If (hr != S_OK) process the error here...
long lParam3=0;
hr = pITPhEvent->get_lParam3(&lParam3);
// If (hr != S_OK) process the error here...
// Process the data here.
//...
pITPhEvent->Release();
break;
}
//...
} // end of switch
//...
}
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應