' 撰寫人:Devil(璉璉) E-Mail: qvb3377@ms5.hinet.net 僅供學術測試使用,引用請註明原出處 ' -------------------------------------------------------------------------------------- ' 記憶體 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long) ' MessageBeep Public Declare Function MessageBeep Lib "user32" (ByVal wType As enuMessageBeep) As Long ' Wave Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long Private Declare Function waveOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long Private Declare Function waveOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long ' 自訂型態 ' MessageBeep Public Enum enuMessageBeep MB_PCSpeaker = -1 MB_ICONASTERISK = &H40& MB_ICONEXCLAMATION = &H30& MB_ICONHAND = &H10& MB_ICONQUESTION = &H20& MB_OK = &H0& End Enum Private Type typVolume Left As Integer Right As Integer End Type Public Function myWaveOutSetVolume(ByVal MainVolume As Long, Optional RightVolume) As Long Dim tVolume As typVolume Dim tRightVolume As Long If Not IsMissing(RightVolume) Then tRightVolume = RightVolume CopyMemory tVolume.Left, MainVolume, 2 CopyMemory tVolume.Right, tRightVolume, 2 CopyMemory MainVolume, tVolume, 4 Else CopyMemory tVolume.Left, MainVolume, 2 CopyMemory tVolume.Right, MainVolume, 2 CopyMemory MainVolume, tVolume, 4 End If nCount = waveOutGetNumDevs summy = waveOutSetVolume(nCount - 1, MainVolume) myWaveOutSetVolume = MainVolume End Function