再谈Visual FoxPro 3.0中背景音乐的实现
首先是建立一个表单(FORM1)。然后双击表单,编写表单FORM1的Activate过程:
Public Sound
Set Library To Foxtools.FLL
Sound=Regfn("SndPlaySound","CI","I","Mmsystem")
=Callfn(Sound,"BACKWAV",1)
再编写FORM1的Release过程:
=Callfn(Sound,"",10)
Set Library To
运行此表单后,BACK.WAV就作为背景音乐在后台播放,当关闭表单时音乐自动停止。若所使用的声音文件较短,还可让其循环播放,只需将Activate过程的最后一句换为:
=Callfn(Sound,"BACK.WAV",1+8)即可。