Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR() Lost Functionality ?
Message
From
31/01/1997 08:37:13
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00018890
Message ID:
00018933
Views:
31
>Some code we used in 2.6 to check Volume Labels of disks / services does not appear in the Help of VFP 3.0 / 5.0 Using example: ADIR(test,"C:\*.*","V") Tests in VFP 5.0 work only if cd C:\ before command is run. If you are in C:\temp and do not run cd, or run cd c:\temp before the command, it fails. Anyone know of another function to read the Volume Label. Looked in SYS() and didn't see one.
>TIA

You can use API function

FUNCTION GET_VOL

Parameter cDisque


cdisque = left(cdisque,1)+":\"

lpRootPathName = cdisque && Drive and directory path
*lpRootPathName = "A:\" && Drive and directory path
lpVolumeNameBuffer = SPACE(256) && lpVolumeName return buffer
nVolumeNameSize = 256 && Size of/lpVolumeNameBuffer
lpVolumeSerialNumber = 0 && lpVolumeSerialNumber buffer


lpMaximumComponentLength = 256
lpFileSystemFlags = 0
lpFileSystemNameBuffer = SPACE(256)
nFileSystemNameSize = 256

RetVal=GetVolInfo(@lpRootPathName, @lpVolumeNameBuffer, ;
nVolumeNameSize, @lpVolumeSerialNumber, ;
@lpMaximumComponentLength, @lpFileSystemFlags, ;
@lpFileSystemNameBuffer, nFileSystemNameSize)

if RetVal # 0
return left(alltrim(lpVolumeNameBuffer),len(alltrim(lpVolumeNameBuffer))-1)
endif


return .f.
Previous
Reply
Map
View

Click here to load this message in the networking platform