On 2002-05-01 02:32, TsTom wrote:
What you have right there is great, Ivan...
Would like to know how to play midi files as well.
Thanks!
<pre/>
Option Explicit
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
'// Function Discription:
'// The mciSendString function sends a command string to an MCI device.
'// The device that the command is sent to is specified in the command string.
'//
'// Success:
'// Returns zero if successful or an error.
'// The low-order word of the returned doubleword value contains the error return value.
'// If the error is device-specific, the high-order word of the return value is the
'// driver identifier; otherwise, the high-order word is zero.
'//
'// Parametre discriptions:
'// -lpszCommand
'// Address of a null-terminated string that specifies an MCI command string.
'// For more information about the command strings, see Command Strings.
'//
'// -lpszReturnString
'// Address of a buffer that receives return information.
'// If no return information is needed, this parameter can be NULL.
'//
'// -cchReturn
'// Size, in characters, of the return buffer specified by the lpszReturnString parameter.
'//
'// -hwndCallback
'// Handle of a callback window if the "notify" flag was specified in the command string.
Const sMidiFile As String = "C:WINDOWSMEDIAimposs[1].mid "
Dim Play
Sub Play_Midi()
'// Discription:
'// Plays a Midi sound File
'// Specified by Const sMidiFile
'//
Play = mciSendString("play " & sMidiFile, 0&, 0, 0)
If Play <> 0 Then MsgBox "Can't PLAY!"
End Sub
Sub Stop_Midi()
Play = mciSendString("close " & sMidiFile, 0&, 0, 0)
End Sub
</pre>