QQ病毒 | 腾讯QQ空间代码专题 | PPT教程专题 | ADSL应用面面俱到 |
Fireworks教程专题 | 计算机和网络技术基础知识 | 校园网专题 | 网吧技术专题 |
在pb中用语音读金额
5、声明一函数,用于最终调用:
Function MyReadMoney(Decimal AMoney)
代码实现如下:
integer i,count
string ls_dxje
ls_dxje = xx2dx(Amoney)
count = len(ls_dxje)
for i= 1 to count step 2
CHOOSE CASE mid(ls_dxje,i,2)
CASE "零"
playsound("0.wav",0)
CASE "壹"
playsound("1.wav",0)
CASE "贰"
playsound("2.wav",0)
CASE "叁"
playsound("3.wav",0)
CASE "肆"
playsound("4.wav",0)
CASE "伍"
playsound("5.wav",0)
CASE "陆"
playsound("6.wav",0)
CASE "柒"
playsound("7.wav",0)
CASE "捌"
playsound("8.wav",0)
CASE "玖"
playsound("9.wav",0)
CASE "拾"
playsound("十.wav",0)
CASE "佰"
playsound("佰.wav",0)
CASE "仟"
playsound("仟.wav",0)
CASE "万"
playsound("万.wav",0)
CASE "亿"
playsound("亿.wav",0)
CASE "元"
playsound("元.wav",0)
CASE "角"
playsound("角.wav",0)
CASE "分"
playsound("分.wav",0)
CASE "整"
playsound("整.wav",0)
END CHOOSE
next
6、在程序中,可以任意调用此函数。当然,可以适当加入出错处理一类的代码。
7、备注:如果不能发声,应检查声音文件是否在可执行文件的同一路径,最好是在函数MyReadMoney中,对各wav文件直接加上路径如C:\temp