Home All Groups Group Topic Archive Search About

How do I deploy a VB6 program to folder whose filename has spaces?

Author
31 May 2005 8:53 PM
Denny D
I have written a program in Visual Basic 6 which plays AVI files using
the API function winmm.dll.  I want to deploy this program to other
PC's.  However, because of a limitation in winmm.dll, the AVI files
will not play when the program is installed to a directory whose
filename contains space(s), e.g. "Program Files", the default folder
for program installation.  There is another API function which
corrects this, but for the life of me, I can't remember whixh one it
is.   Do any of know the name of this DLL file?

Den

Author
31 May 2005 9:43 PM
Ken Halter
"Denny D" <calliope***@hotmail.com> wrote in message
news:8uip91965s0i94dipf65qotsa4bols9act@4ax.com...
>I have written a program in Visual Basic 6 which plays AVI files using
> the API function winmm.dll.  I want to deploy this program to other
> PC's.  However, because of a limitation in winmm.dll, the AVI files
> will not play when the program is installed to a directory whose
> filename contains space(s), e.g. "Program Files", the default folder
> for program installation.  There is another API function which
> corrects this, but for the life of me, I can't remember whixh one it
> is.   Do any of know the name of this DLL file?
>
> Den

The "key" is to wrap filenames in double-quotes.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Sign up now to help keep VB support alive - http://classicvb.org/petition
Please keep all discussions in the groups..
Author
31 May 2005 11:01 PM
MikeD
Show quote Hide quote
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:On4t7miZFHA.796@TK2MSFTNGP10.phx.gbl...
> "Denny D" <calliope***@hotmail.com> wrote in message
> news:8uip91965s0i94dipf65qotsa4bols9act@4ax.com...
>>I have written a program in Visual Basic 6 which plays AVI files using
>> the API function winmm.dll.  I want to deploy this program to other
>> PC's.  However, because of a limitation in winmm.dll, the AVI files
>> will not play when the program is installed to a directory whose
>> filename contains space(s), e.g. "Program Files", the default folder
>> for program installation.  There is another API function which
>> corrects this, but for the life of me, I can't remember whixh one it
>> is.   Do any of know the name of this DLL file?
>>
>> Den
>
> The "key" is to wrap filenames in double-quotes.


Ken (and Denny, et.al.), even that's problematic because MCI has limits on
the length of command strings (I believe it's 128 characters for the
*entire* command string).  A long path and filename can easily cause that
limit to be exceeded.  Therefore, it's best to always get the short path and
filename and use that with MCI.


--
Mike
Microsoft MVP Visual Basic
Author
31 May 2005 9:51 PM
Mike D Sutton
> I have written a program in Visual Basic 6 which plays AVI files using
> the API function winmm.dll.  I want to deploy this program to other
> PC's.  However, because of a limitation in winmm.dll, the AVI files
> will not play when the program is installed to a directory whose
> filename contains space(s), e.g. "Program Files", the default folder
> for program installation.  There is another API function which
> corrects this, but for the life of me, I can't remember whixh one it
> is.   Do any of know the name of this DLL file?

Try this:

'***
Private Declare Function GetShortPathName Lib "Kernel32.dll" Alias "GetShortPathNameA" ( _
    ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long

Private Function MakeShortPath(ByRef inPath As String) As String
    Dim BufLen As Long, StrBuf As String

    BufLen = GetShortPathName(inPath, vbNullString, 0)
    If (BufLen) Then
        StrBuf = Space$(BufLen)
        MakeShortPath = Left$(StrBuf, GetShortPathName(inPath, StrBuf, BufLen))
    End If
End Function
'***

Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
1 Jun 2005 12:09 AM
BeastFish
You're using the mciSendString function?  MciSendString does fart on
path/file names containing spaces.  I'm guessing you're thinking of the
GetShortPathName function of kernel32.


Show quoteHide quote
"Denny D" <calliope***@hotmail.com> wrote in message
news:8uip91965s0i94dipf65qotsa4bols9act@4ax.com...
> I have written a program in Visual Basic 6 which plays AVI files using
> the API function winmm.dll.  I want to deploy this program to other
> PC's.  However, because of a limitation in winmm.dll, the AVI files
> will not play when the program is installed to a directory whose
> filename contains space(s), e.g. "Program Files", the default folder
> for program installation.  There is another API function which
> corrects this, but for the life of me, I can't remember whixh one it
> is.   Do any of know the name of this DLL file?
>
> Den