From: Rencie on 2 Sep 2005 07:48 I want to make a midi file play repeatedly, how do I achieve this in VB 6 using MMControl?
From: Martin Walke on 2 Sep 2005 09:13 Hi Rencie, Unless you want the user controls of the MMControl why not use the sndPlaySound API http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_playsound.asp HTH Martin "Rencie" <Rencie(a)discussions.microsoft.com> wrote in message news:E0A3CA4C-E9BB-487B-8FA9-C31AAFAF2D63(a)microsoft.com... >I want to make a midi file play repeatedly, how do I achieve this in VB 6 > using MMControl?
From: Rencie on 2 Sep 2005 10:31 Thank you. Can you give an example on how to use that in Visual Basic? because, I can't find an example in my MSDN Library Visual Basic Documentation.
From: Martin Walke on 2 Sep 2005 11:09 Hi Rencie Declare the API call either in your form and use private Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long or in a module and make in public Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Add the constants Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_NODEFAULT = &H2 Const SND_MEMORY = &H4 Const SND_LOOP = &H8 Const SND_NOSTOP = &H10 Then simply ret = sndPlaySound("c:\windows NT\media\flourish.mid", SND_ASYNC or SND_LOOP) To stop the sound, specify the file but without the SND_LOOP flag set ret = sndPlaySound("c:\windows NT\media\flourish.mid", SND_ASYNC) There appears to be a problem with using sndPlaySound on XP although it works for me :). If that is the case then use PlaySound (see previous link for info) but basically the flags are the same and the definition is : Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long and specify 0 as the second parameter ret = PlaySound("c:\windows NT\media\flourish.mid", 0, SND_ASYNC or SND_LOOP) HTH Martin "Rencie" <Rencie(a)discussions.microsoft.com> wrote in message news:CA531598-C101-4828-ABF1-613BED20C7B7(a)microsoft.com... > Thank you. Can you give an example on how to use that in Visual Basic? > because, I can't find an example in my MSDN Library Visual Basic > Documentation.
From: Rencie on 2 Sep 2005 13:06
Thanks a lot, I'll try that and I'll let you know. ok? Thanks again. |