⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playwave.bas

📁 小宠物-电子鸡源程序
💻 BAS
字号:
Attribute VB_Name = "Module1"
'Module:   PlayWave.BAS
'                Play a Wave file.
'Author:    Pheeraphat Sawangphian
'E-Mail:     tooh@thaimail.com
'URL:       http://www.geocities.com/Hollywood/Lot/6166

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Private Const SND_SYNC = &H0                          'play synchronously (default)
Private Const SND_ASYNC = &H1                        'play asynchronously
Private Const SND_NODEFAULT = &H2              'silence not default, if sound not found
Private Const SND_MEMORY = &H4                    'lpszSoundName points to a memory file
Private Const SND_ALIAS = &H10000                  'name is a WIN.INI [sounds] entry
Private Const SND_FILENAME = &H20000          'name is a file name
Private Const SND_RESOURCE = &H40004        'name is a resource name or atom
Private Const SND_ALIAS_ID = &H110000           'name is a WIN.INI [sounds] entry identifier
Private Const SND_ALIAS_START = 0                 'must be > 4096 to keep strings in same section of resource file
Private Const SND_LOOP = &H8                           'loop the sound until next sndPlaySound
Private Const SND_NOSTOP = &H10                    'don't stop any currently playing sound
Private Const SND_VALID = &H1F                        'valid flags
Private Const SND_NOWAIT = &H2000                'don't wait if the driver is busy
Private Const SND_VALIDFLAGS = &H17201F     'Set of valid flag bits.  Anything outside this range will raise an error
Private Const SND_RESERVED = &HFF000000  'In particular these flags are reserved
Private Const SND_TYPE_MASK = &H170007

Public Sub PlayWave(Filename As String, SoundOn As Boolean, WaveSound As Boolean)
    If (SoundOn) Then
        If WaveSound Then
            sndPlaySound Filename, SND_NODEFAULT + SND_ASYNC
        Else
            Beep
        End If
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -