<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Bericht</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I found that I have changed it to mci, but I
remember at the beginning I had used Playsound, jsut cnnot find whether I have
the old code still somewhere.</FONT></DIV>
<DIV><FONT face=Arial size=2>anyway, if youare interested, here is the module
with MCI.</FONT></DIV>
<DIV><FONT face=Arial
size=2>--------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>Public Declare Function mciSendString Lib
"winmm.dll" Alias "mciSendStringA" (ByVal _<BR> lpszCommand As
String, ByVal lpszReturnString As String, ByVal cchReturnLength
_<BR> As Long, ByVal hwndCallback As Long) As Long<BR>Public
Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA"
(ByVal _<BR> fdwError As Long, ByVal lpszErrorText As String,
ByVal cchErrorText As Long) As Long</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Public Function DisplayError(ByVal errcode As
Long)<BR> ' This subroutine displays a dialog box with the
text of the MCI error. There's<BR> ' no reason to use
the MessageBox API function; VB's MsgBox function will
suffice.<BR> Dim errstr As String ' MCI error message
text<BR> Dim retval As Long ' return
value<BR> <BR> ' Get a string explaining the
MCI error.<BR> errstr = Space(128)<BR>
retval = mciGetErrorString(errcode, errstr, Len(errstr))<BR> '
Remove the terminating null and empty space at the end.<BR>
errstr = Left(errstr, InStr(errstr, vbNullChar) - 1)<BR> '
Display a simple error message box.<BR> retval =
MsgBox(errstr, vbOKOnly Or vbCritical)<BR>End Function</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Public Function lsPlayMusic(strFilePath As String)
As Boolean<BR> ' Open the file "C:\Music\MusicPlaying.mid" for
later use in the example.<BR> ' Give it an alias of
"MusicPlaying" so we don't need to refer to the filename
again.<BR> ' Begin playback of the MIDI file when this button
is pressed.<BR> Dim errcode As Long ' MCI error
code<BR> Dim strOpen As String<BR>
Debug.Print strFilePath<BR> If strFilePath <> ""
Then<BR> strOpen = "open """ &
strFilePath & """ alias MusicPlaying"<BR>
Else<BR> Exit
Function<BR> End If<BR> errcode =
mciSendString(strOpen, "", 0, 0)<BR> If errcode <> 0
Then DisplayError errcode<BR> errcode = mciSendString("play
MusicPlaying", "", 0, 0)<BR> If errcode <> 0
Then<BR> lsPlayMusic =
False<BR> 'DisplayError
errcode<BR> Else<BR>
lsPlayMusic = True<BR> End If<BR>End Function</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Public Function lsPlayMusicToEnd(strFilePath As
String) As Boolean<BR> ' Open the file.<BR>
' Give it an alias of "MusicPlaying" so we don't need to refer to the filename
again.<BR> Dim errcode As Long ' MCI error
code<BR> Dim strOpen As String<BR> If
strFilePath <> "" Then<BR>
strOpen = "open """ & strFilePath & """ alias
MusicPlaying"<BR>
Else<BR> Exit
Function<BR> End If<BR> errcode =
mciSendString(strOpen, "", 0, 0)<BR> If errcode <> 0
Then DisplayError errcode<BR> ' Begin playback of the file.
The 'wait' keyword causes MCIsendString to return after<BR> '
the playback is finished<BR> errcode = mciSendString("play
MusicPlaying wait", "", 0, 0)<BR> ' Stop playback of the
file.<BR> errcode = mciSendString("stop MusicPlaying", "", 0,
0)<BR> ' Close the file. This is important, because
the<BR> ' driver can only work with one file at a time.
There's no need to check<BR> ' for an error here, since we're
just closing the file.<BR> errcode = mciSendString("close
MusicPlaying", "", 0, 0)<BR> If errcode <> 0 Then
DisplayError errcode<BR>End Function</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>Public Function lsStopMusic() As Boolean<BR> ' Stop
playback of the file.<BR> Dim errcode As Long ' MCI
error code<BR> errcode = mciSendString("stop MusicPlaying",
"", 0, 0)<BR> If errcode <> 0
Then<BR> lsStopMusic =
False<BR> 'DisplayError
errcode<BR> Else<BR>
lsStopMusic = True<BR> End If<BR> ' Close
the file. This is important, because the<BR> ' driver
can only work with one file at a time. There's no need to
check<BR> ' for an error here, since we're just closing the
file.<BR> errcode = mciSendString("close MusicPlaying", "", 0,
0)<BR>End Function</DIV>
<DIV> </DIV>
<DIV><BR>Public Function lsOpenFileForMusic()<BR>
lsOpenFileForMusic = GetFilePath(, "|mp3 Files|*.mp3|WAV Files|*.wav")<BR>End
Function<BR></FONT></DIV>
<DIV><FONT face=Arial
size=2>--------------------------------------------</FONT></DIV>
<DIV>Lembit Soobik<BR></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV><FONT face=Arial size=2></FONT><BR></DIV>
<DIV><SPAN class=562571406-13102003><FONT face=Arial color=#0000ff size=2>The
Windows Media player control plays MP3/WMA , but I stoppped using that because
I had some delay on it (using .WAV).</FONT></SPAN></DIV>
<DIV><SPAN class=562571406-13102003><FONT face=Arial color=#0000ff size=2>This
when loading the file.</FONT></SPAN></DIV>
<DIV><SPAN class=562571406-13102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=562571406-13102003><FONT face=Arial color=#0000ff
size=2>Erwin</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=nl dir=ltr align=left><FONT face=Arial
size=2>hmmmm... I did not realize there is a problem. I will dig into the
code tomorrow and let you all know. it is a pretty old db and I have since
modified that part, but I rmember Playsound to work with mp3 as well as wav.
too late today.</FONT></DIV>
<DIV><FONT face=Arial size=2>Lembit</FONT></DIV>
<DIV> </DIV>
<DIV>Lembit Soobik<BR></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR></DIV>
<DIV><FONT face=Arial size=2>...how did you manage that Lembit ...I get an
error if I spec anything other than a wav file?</FONT></DIV>
<DIV> </DIV>
<DIV>William Hindman<BR><FONT face=Arial
size=2></FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>