Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetLongPathName
Message
From
11/02/2002 10:56:59
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00618327
Message ID:
00618358
Views:
37
>>>>Actually, GetLongPathName works fine. Trouble is it does'nt exist prior to windows 98/2000. Anything I can use that is included in the earlier versions of windows (95,NT)?
>>>>
>>>
>>>SHGetFileInfo(), with any OS implementing Shell v 4.0 or later, including Win95 and WinNT, although you'll have to upgrade the shell components on original Win95 retail installations. It's a good idea to do so IAC, since original Win95 is pretty badly flawed.
>>
>>Ed,
>>Thanks for the tip. Trouble is there are several and varied customers out there and several probably do have the retail install of 95. I have been trying to make GetFullPathName work but can figure out how to lpass the last parameter (a pointer) and what it is expecting there, i.e. what it is supposed to point to. Not even sure if that API will work anyway.
>>
>>What do you think?
>
>It's trivial:
>
>
DECLARE INTEGER GetFullPathName IN WIN32API ;
>   STRING @ LPCTSRSHORTNAME, ;
>   STRING @ LPTSRFULLNAME, ;
>   INTEGER cbBuffer
>cFullName = REPL(chr(0), 262)
>nBufLen = 261
>IF GetFullPathName('Short\path\name'+CHR(0),@cFullName,nBufLen) # 0
>   cFullName = STRTRAN(cFullName,CHR(0),'')
>ELSE
>   && retrieve error using GetLastError()
>ENDIF
>
>It isn't supported by Win95.

Actually, it's
DECLARE INTEGER GetFullPathName IN WIN32API ;
   STRING @ lpFileName, ;
   INTEGER dwBufferLen, ;
   STRING @ lpBuffer, ;
   INTEGER lpFileName
cFullName = REPL(chr(0), 262)
nBufLen = 261
lpFileName = 0
IF GetFullPathName('FileName', nBufLen, @cFullName, @lpFileName) > 0
lpFileName will be invalid unless you allocate a static buffer outside the VFP memory space using a tool like ClsHeap, since the buffer result will be moved on return from the function call if it points to a VFP string. If you use ClsHeap, allocate a buffer of 261 characters, change the definition of lpBuffer to INTEGER rather than STRING @, pass the address of the buffer to the function and use the CopyFrom() method or the GetMemString() UDF to move the result back to VFP string space.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform