->-chengdx
回答1:
Mmsound.drv是小喇叭的系統接口,很多API的書都有用法介紹
-219張晶
回答2:
使用VB中的beep語句,但這只能發出一種聲音。如果想發出不同聲音,可以
使用API函數。詳情如下:(摘自VB-Helper)
UsetheBeepAPIfunction.
Thisexampledemonstratestwointerestingthings.First,itshowshowtomakeabeepofanyfrequencyanddurationratherthanusingthestandardtoneyougetwiththeBeepstatement.
Second,notethattheBeepAPIfunctionhasthesamenameasVisualBasic'sBeepstatement.Todifferentiatethem,youcanassignanewnametotheBeepAPIfunctioninitsDeclarestatement.Itisknownas"Beep"inthelibrary(theAliasstatement)butitisknownasAPIBeeptotheprogram.
Youcanusethistechniquetodifferentiatebetweenfunctionswiththesamename,oryoucanuseittogiveAPIfunctionsanamethatiseasiertowrite(forexample,iftheAPInameisverylong).
Inthedeclarationssection:
OptionExplicit
PrivateDeclareFunctionAPIBeepLib"kernel32"Alias"Beep"(ByValdwFreqAsLong,ByValdwDurationAsLong)AsLong
'Tomakeabeeplasting500millisecondswithfrequencyspecifiedinthe
'TextBoxtxtFrequency(try1000forstarters):
PrivateSubCommand1_Click()
DimfrequencyAsLong
frequency=CLng(txtFrequency.Text)
APIBeepfrequency,500
EndSub
-Prisoner->->