看你用的什么语音卡,一般都是有SDK读取的。
解决方案 »
- delphi6/7 能不能在 vista 下正常运行???? 请用过 vista 的朋友发言???????????
- 如何编写网络信箱检索程序?及pop信箱发送邮件
- “贺岁华东行”--与技术总监和Borland产品专家面对面2004元旦
- 有人用Interbase吗?
- midas中登录Dcom时的用户问题
- 怎样在DbGrid中象显示其他字段一样也将图像字段显示在网格内??
- 求出listbox中的数据总和
- 有关XPMENU的问题
- 关于TAdoTable的Lookup方法,它是每次都执行从头找的吗?新手问题
- 问多媒体时钟控件
- 制作共享软件用什么语言开发比较好
- delphi如何把pdf格式的文件转换成jpg格式
var s,TelPhone:string;
i:integer;
begin
TelPhone:='';
S:=DBGrid1.SelectedField.AsString;
for i:=1 to Length(S) do
begin
if (48<=Ord(S[I])) and (Ord(S[I])<=57) then // 有效数字0123456789
TelPhone:=TelPhone+S[I];
end;
if length(TelPhone)<2 then exit;
with CallParams do
begin
dwTotalSize := sizeof(CallParams);
dwBearerMode := LINEBEARERMODE_VOICE;
dwMediaMode:=LINEMEDIAMODE_INTERACTIVEVOICE;
end;
if lineInitialize(@lineApp,HInstance,@lineCallBack,'',nDevs)<0
then showmessage('线路不能初始化!')
else if nDevs=0 // 无TAPI设备
then begin
lineShutDown(lineApp);
lineApp:=0;
end
else // 协商TAPI版本号 TAPI1.4¡«TAPI2.0
if lineNegotiateAPIVersion(lineApp,0,$00010004,$00020000,
tapiVersion,extid)<0
then begin
showmessage('TAPI版本不兼容!');
lineShutDown(lineApp);
lineApp:=0;
end
else errorcode:=lineOpen(lineApp,LINEMAPPER,@line,tapiVersion,0,0,LINECALLPRIVILEGE_NONE,LINEMEDIAMODE_INTERACTIVEVOICE,@CallParams); // 打开线路
if errorcode<0
then showmessage('线路不能打开!')
else begin // 线路成功打开
lineConfigDialog(0,Self.Handle,nil);
lineGetIcon(0,'tapi/line',@lineIcon);
if lineMakeCall(line,@call,PChar(TelPhone),0,@CallParams)<0
then showmessage('呼叫失败!')
else begin
showmessage('请摘机通话!');
lineHandOff(call,'µç»°²¦ºÅ³ÌÐò',LINEMEDIAMODE_INTERACTIVEVOICE);
lineShutDown(lineApp);
end;
end;end;
procedure lineCallback(hDevice, dwMsg, dwCallbackInstance,
dwParam1, dwParam2, dwParam3: LongInt); stdcall;//Òì²½ºô½Ð·µ»Ø´¦Àíº¯Êý
var Call: HCall;
begin
if dwMsg = LINE_REPLY then
if dwParam2 < 0 then
showmessage('呼叫响应错误!')
else
if dwMsg = LINE_CALLSTATE then begin
Call := HCall(hDevice); case dwParam1 of
LINECALLSTATE_IDLE:
if call <> 0 then
begin
lineDeallocateCall(Call);
end;
LINECALLSTATE_PROCEEDING:showmessage('呼叫正常处理!');
LINECALLSTATE_DIALTONE:showmessage('检测到拔号音!');
LINECALLSTATE_DIALING: showmessage('正在拔号!');
LINECALLSTATE_DISCONNECTED:
begin
if dwParam2=LINEDISCONNECTMODE_NORMAL then showmessage('正常断开')
else
if dwParam2=LINEDISCONNECTMODE_BUSY then showmessage('线路忙');
end;
LINECALLSTATE_BUSY:showmessage('线路忙处理');
end;
end;
end;
重新上传,DBGrid的鼠标右键事件:
var s,TelPhone:string;
i:integer;
begin
TelPhone:='';
S:=DBGrid1.SelectedField.AsString;
for i:=1 to Length(S) do
begin
if (48<=Ord(S[I])) and (Ord(S[I])<=57) then // 有效数字0123456789
TelPhone:=TelPhone+S[I];
end;
if length(TelPhone)<2 then exit;
with CallParams do
begin
dwTotalSize := sizeof(CallParams);
dwBearerMode := LINEBEARERMODE_VOICE;
dwMediaMode:=LINEMEDIAMODE_INTERACTIVEVOICE;
end;
if lineInitialize(@lineApp,HInstance,@lineCallBack,'',nDevs)<0
then showmessage('线路不能初始化!')
else if nDevs=0 // 无TAPI设备
then begin
lineShutDown(lineApp);
lineApp:=0;
end
else // 协商TAPI版本号 TAPI1.4¡«TAPI2.0
if lineNegotiateAPIVersion(lineApp,0,$00010004,$00020000,
tapiVersion,extid)<0
then begin
showmessage('TAPI版本不兼容!');
lineShutDown(lineApp);
lineApp:=0;
end
else errorcode:=lineOpen(lineApp,LINEMAPPER,@line,tapiVersion,0,0,LINECALLPRIVILEGE_NONE,LINEMEDIAMODE_INTERACTIVEVOICE,@CallParams); // 打开线路
if errorcode<0
then showmessage('线路不能打开!')
else begin // 线路成功打开
lineConfigDialog(0,Self.Handle,nil);
lineGetIcon(0,'tapi/line',@lineIcon);
if lineMakeCall(line,@call,PChar(TelPhone),0,@CallParams)<0
then showmessage('呼叫失败!')
else begin
showmessage('请摘机通话!');
lineHandOff(call,'µç»°²¦ºÅ³ÌÐò',LINEMEDIAMODE_INTERACTIVEVOICE);
lineShutDown(lineApp);
end;
end;end;