Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WINMM.DLL and Saving File Names
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00552081
Message ID:
00552171
Vues:
17
>I have a problem with saving a file using the WINMM.DLL. Having declared the dll, if I issue these commands:
>
>ThisForm.FileName = PutFile([Save file as:], [], [wav])
>if !empty(ThisForm.FileName)
> if [ ] $ ThisForm.FileName
> messagebox([Spaces are not allowed anywhere in the path or name of this file]+chr(13)+chr(10)+;
> [You are trying to save this to: ]+ThisForm.FileName,16,[Illegal Path or Name])
> else
> SendString = chr(34)+[save capture ]+ThisForm.FileName+chr(34)
> mciSendString(&SendString,"0",0,0)
> ThisForm.cmdGroup.Command1.Enabled = .F.
> ThisForm.cmdGroup.Command2.Enabled = .F.
> This.Enabled = .F.
> ThisForm.CreateLink
>endif
>
>the file is saved properly as long as there are no spaces in ThisForm.FileName. So there are two possible options:
>
>1. Someone can instruct me as to how to save a file name path with spaces through the dll.
>
>2. Someone can instruct me as to how to convert the file name path with spaces to and C:\PROGRA~1\MYWave.wav format.
>
>If anyone can answer either of these questions it would be most helpful.
>
>TIA
>
>DJ Hunt :o)

Donald,

What's the function you're using to save the file? AFAIK, WINMM.DLL's sndPlaySound() function works fine with long file names. So I'm not so sure that's the problem.

However, the Windows API function GetShortPathName() returns this information if need be.
DECLARE INTEGER GetShortPathName IN Win32API;
 STRING @lpszLongPath, STRING @lpszShortPath,;
 INTEGER cchBuffer
lnsize = 100
lcbuffer = SPACE(lnsize)
* lcfile is the file of interest
lnresult = GetShortPathName(@lcfile, @lcbuffer, lnsize)
? LEFT(lcbuffer, lnresult)
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform