au是什么格式啊??sndPlaySound
The sndPlaySound function plays a waveform sound specified either by a filename or by an entry in the registry or the WIN.INI file. This function offers a subset of the functionality of the PlaySound function; sndPlaySound is being maintained for backward compatibility.
use .wav files
The sndPlaySound function plays a waveform sound specified either by a filename or by an entry in the registry or the WIN.INI file. This function offers a subset of the functionality of the PlaySound function; sndPlaySound is being maintained for backward compatibility.
use .wav files
解决方案 »
- 如何获取vb6 DataReport的导出保存路径?
- 调用Api后出错的问题
- 一个VB+SQL Server系统的数据库备份的问题~~请指教~
- 怎样实现用sendkeys发送键盘按键命令?
- 高分在线急求~~~~~~~~~~~~~~~~~~~~~~~关于让html代码的如何显示在webbrowse中
- 关于调用winapi获取组件信息,急! (api)
- 有什么办法让VB的代码不带运行库运行!
- 急!有没有vb自带的表格控件可以不用数据库,自由控制某行某列的内容?
- 《〈〈*****在线求助,代理服务器的问题?*****〉〉》
- 关于很多api在win2000下使用,遇到找不到dll入口点的问题?
- 关于filecopy,高手请进
- 求救
This article demonstrates how to create a Visual Basic project that plays audio files with the AU file extension. The project uses the DirectShow run-time file, Quartz.dll, version 5.1.18.1024 or later. This DirectShow run-time file is shipped with Internet Explorer 4.01 and Visual Studio 6.0. MORE INFORMATION
This section assumes you are familiar with using objects and references in your Visual Basic project and that you have a .AU file to use with the project. If you are not familiar with using objects and references in your Visual Basic project, see the REFERENCES section of this article. Steps to Create the Project
Start a new Standard EXE project in Visual Basic. Form1 is created by default.
From the Project menu, select References, and add a reference to the DirectShow runtime file, quartz.dll. You may need to Browse for this file in your System directory. After you make a reference to this file, the ActiveMovie Control type library appears in the Available References list box of the References dialog box.
Add a CommandButton to Form1.
Paste the following code to the Code window of Form1. Change the String variable MyFile to the path and filename of your AU file: Option ExplicitPrivate Sub Command1_Click()
Static PMC As Object
Dim MyFile As String MyFile = "<Path and Filename of the AU file>"
Set PMC = New FilgraphManager
PMC.RenderFile MyFile
PMC.Run
End Sub
On the Run menu, select Start, or press the F5 key to start the program. Click on Command1 and the AU file will start playing.
欢迎发Email与我进一步交流。
Email:[email protected]
通用声明中:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As LongPrivate Sub Command6_Click()
Dim k
k = sndPlaySound("e:\file1532.wav",&H8)
End Sub
但是还是没有声音。(无计可施)
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10
Sub PlayWav(SoundName As String)
Dim tmpSoundName As String
Dim wFlags%, X%
tmpSoundName = VB.App.Path & "\" & SoundName
wFlags% = SND_ASYNC Or SND_NODEFAULT
X% = sndPlaySound(tmpSoundName, wFlags%)
End Sub//try this
Private Declare Function sndPlaySound Lib "WINMM.DLL" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As _
Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
然后使用
sndPlaySound("c:\windows\tada.wav", SND_ASYNC Or SND_NODEFAULT) 我怀疑是dim k没有类型造成的。所以试试这样dim k as integer