Re: mcisendstring - long path names
From: MikeD (nobody_at_nowhere.edu)
Date: 02/03/04
- Next message: Vlad: "Re: How to prevent Windows turn off?"
- Previous message: Steven Burn: "Re: How to prevent Windows turn off?"
- In reply to: Morph: "mcisendstring - long path names"
- Next in thread: Don_at_home.com: "Re: mcisendstring - long path names"
- Reply: Don_at_home.com: "Re: mcisendstring - long path names"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 3 Feb 2004 11:14:07 -0500
"Morph" <none@none.com> wrote in message
news:7OMTb.16378$JL4.134140@newsfep4-glfd.server.ntli.net...
> Using XP I have an app in a sub folder in Docs and Settings that uses
> mciSendString to play a *.mid file but it will not play unless I move the
> app folder to a higher directory. Debug mciGetErrorString says "open: The
> specified command requires an alias, file, driver, or device name. Please
> supply one.", yet all these requirements are in place. Im even using
> GetShortPathName which gives the exact same results whereby the app is
only
> fully functional if it is in a higher directory. I can post the code if
> anyone needs more info but I am using the basic Open, Play, Close
commands.
You should have just posted your code to begin with. Yes, seeing the code
in necessary, so please post it. Be sure to post the code you're using to
both open and play the midi file, as well as your code for getting the short
file name and API declarations. The exact strings for any of your string
variables would be helpful too (for example, the exact path). From the
error message you're getting from MCI, I'm not convinced it really has
anything to do with a long file name, but it could. The fact that you're
obtaining a short file name doesn't lend credence to it being a long file
name problem. What folder, specifically, does it NOT play in? Does the
currently logged on user have permissions for that folder? For example,
does the .mid file exist in a profile folder of another user?
> Why does mcisendstring not like long path names or spaces?
MCI uses spaces to separate arguments in the command string; therefore, if a
long path or filename contains spaces, MCI assumes what follows the space is
another argument.
> Is there a point
> where GetShortPathName could be too long?
I suppose, but I've yet to encounter it. FWIW, I tested the following code
(using the hard-coded path\filename) and it worked fine.
Dim sFileName As String
Dim sBuffer As String
sFileName = "E:\Documents and Settings\Mike Davis\Application Data\My
Application Name\Midi Files\For Those About To Rock (We Salute You).mid"
sBuffer = String$(260, vbNullChar)
GetShortPathName sFileName, sBuffer, 260
sFileName = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)
mciSendString "open " & sFileName & " type sequencer alias MIDI wait",
vbNullString, 0&, 0&
mciSendString "play MIDI", vbNullString, 0&, 0&
Stop
mciSendString "close all", vbNullString, 0&, 0&
Mike
- Next message: Vlad: "Re: How to prevent Windows turn off?"
- Previous message: Steven Burn: "Re: How to prevent Windows turn off?"
- In reply to: Morph: "mcisendstring - long path names"
- Next in thread: Don_at_home.com: "Re: mcisendstring - long path names"
- Reply: Don_at_home.com: "Re: mcisendstring - long path names"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|