发表于:2006/9/20 9:53:00
#0楼
我在C# 下,用TAPI编写来电显示,以下的代码是TAPI事件处理部分,为什么当电话打入的时候,出现错误,无法显示电话号码,提示说“对COM组件的调用返回了错误”,用TAPI显示电话号码需要注意什么吗?请使用过TAPI的朋友作答,谢谢。
C#代码:
public void Event(TAPI3Lib.TAPI_EVENT te, object eobj)
{
string str = "";
switch (te)
{
case TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION:
str = "有电话打入";
break;
case TAPI3Lib.TAPI_EVENT.TE_CALLSTATE:
TAPI3Lib.ITCallStateEvent itcallstateevent = (TAPI3Lib.ITCallStateEvent)eobj;
TAPI3Lib.ITCallInfo itcallinfo = itcallstateevent.Call;
switch (itcallinfo.CallState)
{
case CALL_STATE.CS_OFFERING:
str = "CS_OFFERING";
Invoke(new eventHandler(eventdispose), TAPI3Lib.TAPI_EVENT.TE_CALLSTATE, str);
try
{
str=itcallinfo.get_CallInfoString(CALLINFO_STRING.CIS_CALLEDIDNUMBER);
}
catch (Exception e)
{
str = e.ToString();
}
break;
}
break;
}
Invoke(new eventHandler(eventdispose), TAPI3Lib.TAPI_EVENT.TE_CALLSTATE, str);
}
C#代码:
public void Event(TAPI3Lib.TAPI_EVENT te, object eobj)
{
string str = "";
switch (te)
{
case TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION:
str = "有电话打入";
break;
case TAPI3Lib.TAPI_EVENT.TE_CALLSTATE:
TAPI3Lib.ITCallStateEvent itcallstateevent = (TAPI3Lib.ITCallStateEvent)eobj;
TAPI3Lib.ITCallInfo itcallinfo = itcallstateevent.Call;
switch (itcallinfo.CallState)
{
case CALL_STATE.CS_OFFERING:
str = "CS_OFFERING";
Invoke(new eventHandler(eventdispose), TAPI3Lib.TAPI_EVENT.TE_CALLSTATE, str);
try
{
str=itcallinfo.get_CallInfoString(CALLINFO_STRING.CIS_CALLEDIDNUMBER);
}
catch (Exception e)
{
str = e.ToString();
}
break;
}
break;
}
Invoke(new eventHandler(eventdispose), TAPI3Lib.TAPI_EVENT.TE_CALLSTATE, str);
}
[此贴子已经被作者于2006-9-20 10:00:09编辑过]