Now this seems really strange to me, but maybe one of you out there will know what the reason for this is.
I've copied some code to get a midi file playing when my splash screen loads. I wanted to use a midi file I had put in the subfolder of c:\Program Files where the rest of my project resides. The thing just would not play so just as I was about to give up on having music with my splash screen, I tried copying the file to the desktop, switched the file path to the desktop file and voila! I had sound!!! I really don't understand how a midi file could work off the desktop but not in the same folder that the rest of my project resides.
I don't want people to install this program and have a midi file added to their desktop, so I tried stashing it in the \Windows\Media and it works from there, too. I know, if it ain't broke, don't fix it, but I'm totally perplexed as to why it seems I can only get my midi to play when the file is in a subfolder of \Windows.
Does any of this sound familiar to anyone?
If it helps, here's the code that relates to midi:
In the main module:
In the splash screen general:Code:Option Explicit Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _ (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _ ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
The splash screen form load:Code:Public Sub sndPlayM(Filename As String) Call mciSendString("Open " & Filename & " Alias MM", 0, 0, 0) Call mciSendString("Play MM", 0, 0, 0) End Sub
It works like this, but why the heck wouldn't it work when I had sndPlayM pointing to "C:\Program Files\Pest\Hall.mid"?????Code:Private Sub Form_Load() sndPlayM "C:\Windows\Media\Hall.mid"




Reply With Quote