为此,需要完成以下内容:
1、分别录制各WAV文件:0,1,2,3,4,5,6,7,8,9,元,角,分,拾,佰,仟,万,亿,整
2、在工程中声明两个External 函数(Windows的API函数),用于发声;
Function boolean sndPlaySoundA (string SoundName, uint Flags) Library "WINMM.DLL"
Function uint waveOutGetNumDevs () Library "WINMM.DLL"
3、新建一函数用于在程序中调用发声:
Function PlaySound(string as_filename,integer ai_option) returns integer
该函数的代码如下:
uint lui_numdevs
lui_numdevs = WaveOutGetNumDevs()
If lui_numdevs > 0 Then
sndPlaySoundA(as_filename,ai_option)
return 1
Else
return -1
End If
4、新建一函数用于将小写金额转换成大写金额:
Function xx2dx(Decimal ls) returns string
代码实现如下:
string dx_sz,dx_dw,str_int,str_dec,dx_str,fu,a,b,b2,c,d,result
long num_int,num_dec,len_int,i,a_int,pp
dx_sz = "零壹贰叁肆伍陆柒捌玖"
dx_dw = "万仟佰拾亿仟佰拾万仟佰拾元"
……