Re: mcisendstring - long path names

From: MikeD (nobody_at_nowhere.edu)
Date: 02/03/04


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



Relevant Pages

  • Re: Newbie Questions
    ... applications folder within their home folder for apps they do not wish ... > the switched-to app's body window to the foreground and sometimes not. ... > also not do it when none of my apps is the current app. ... > - How can I play a song with iTunes without bringing up an iTunes UI? ...
    (comp.sys.mac.system)
  • Re: Songbird...
    ... exactly the same as iTunes can be (if you tell it to leave the files ... folder then the particular Quo album then the track and play it. ...
    (uk.comp.sys.mac)
  • Re: Songbird...
    ... It just gives you an interface to find your files and play then easily. ... All your music files are in your iTunes library folder, in subfolders organised by artist, then in subfolders by album. ... If I want to listen to some Quo I choose the Quo ...
    (uk.comp.sys.mac)
  • Re: Ohhh....Ramesh, Kelly....Thank you
    ... If you want to check, use the Folder Options, FileTypes dialog. ... Windows XP Shell/User ... "Ratan Maitra" wrote in message ... "Play all" doesn't work even when I have only .mp3 files in My Music....or ...
    (microsoft.public.windowsxp.general)
  • Re: Can access playlists but not music folders
    ... I have the check box checked that says 'Share my media to'. ... If I select the icon representing my AV receiver, ... drive and folder that contains all of my music and playlists. ... I can access and play any MP3 in my library via WMP11 on my computer. ...
    (microsoft.public.windowsmedia.player)