zoukankan      html  css  js  c++  java
  • 播放WAV

    vb6使用方法

    '声明

    Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
     Const SND_ASYNC = &H1   '异步播放
     Const SND_SYNC = &H0   '同步播放   (缺省)
    Private opFlag As Boolean

    '调用

    Dim SoundFile As String, Result As Long
    SoundFile = "goodsound.wav"
    Result = sndPlaySound(SoundFile, SND_ASYNC)

    '注:

     '       将winmm.dll和goodsound.wav拷贝到程序目录下

    vb.net使用方法

    '声明 

    Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal lpszSoundName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
        Const SND_FILENAME As Integer = &H20000

        Const SND_ALIAS As Integer = &H10000

        Const SND_SYNC As Integer = &H0

    '调用
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim SoundFile As String
            SoundFile = "goodsound.wav"
            PlaySound(SoundFile, 0, SND_FILENAME)
        End Sub

    '注:

          '将winmm.dll和goodsound.wav拷贝到程序目录下

    还是有点区别的

  • 相关阅读:
    C#循环语句练习(三)
    C#循环语句练习(二)
    C#的循环语句(一)
    switch case
    C#的选择语句
    C#的选择语句练习(二)
    C#的选择语句练习(一)
    2015.10.30
    16.缓存(Cache)
    15.禁用ViewState
  • 原文地址:https://www.cnblogs.com/TNTZWC/p/1460325.html
Copyright © 2011-2022 走看看