Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SYS(16) returning tilde in path name.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00474804
Message ID:
00476773
Vues:
24
>>I’m trying to find the cause of apparent inconsistent behavior of SYS(16) in VFP6.
>>
>>If I have a space in the path name, such as “C:\Program Files\MyExe”, SYS(16) will sometimes return “C:\Program~1\MyExe” but other times return the correct path with the space. I’ve tried to create simple exe programs to duplicate the problem but all of my tests return the correct path. Only in my production app do I get this behavior but I can’t discover what is causing it.
>>
>>One thing that I have is a “startup” exe which calls the main exe (both in the same directory) and the problem is happening in the main exe (it works fine in the startup exe). I have tried to made two test exes to see if it was the fact that SYS(16) was being called from a second tier exe but the tests work fine. Also, elsewhere in the main exe SYS(16) returns the full path. The behavior seems to be inconsistent but there must be some cause that I am not seeing.
>>
>
>If the shortcut uses a short file name, then that's what's available to SYS(16); the path is completely valid, it's just the short name rather than the long name. You can call the Win32API to convert it. You'd call GetLongPathName() to convert it in Win98/Win2K or later:
>
>DECLARE INTEGER GetLongPathName IN WIN32API STRING @, STRING @, INTEGER
>cLongPath = REPL(CHR(0),261)
>=GetLongPathName(cShortPath,@cLongPath,261)
>? LEFT(cLongPath,AT(CHR(0),cLongPath)-1)
>

Ed,

I'm not sure that I know what you mean by "the shortcut uses a short file name". This is just a simple lcReturn = SYS(16) and having lcReturn end up with a tilde in the path name. Even though the path with the tilde is valid I do need the complete path for comparison and display purposes. I'll give the GetLongPathName in Win32API a try. I wasn't aware of this function.

Thanks.

Ed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform