Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding a Volume Label
Message
 
À
01/03/2002 11:13:16
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00626993
Message ID:
00627014
Vues:
16
Cetin,

Your suggesion of not using a parameter on the FOPEN() command worked wonders! Thanks for your help.

Jeff

>>I have a program that uses low-level file functions to catalog files found on a CD-ROM drive. I have two questions.
>>
>>#1 - how do I find the volume label of a drive? I found this on the KB but am not able to turn it around to tell me what the current volume is.
>>
>> DECLARE INTEGER SetVolumeLabel IN Win32API STRING lcRootPath,;
>> STRING lcVolumeLabel
>>
>> liRetVal = 0
>> * Message box with OK/Cancel buttons
>> liRetVal = MESSAGEBOX("Insert scratch floppy disk in drive A:",;
>> 1)
>>
>> * Handle non-OK selection from message box
>> IF liRetVal # 1
>> RETURN
>> ENDIF
>>
>> lcVolumeLabel = "Test"
>> = SetVolumeLabel ("A:\", lcVolumeLabel)
>>
>>#2 - How can I FOPEN(cfilename,10) &Read_Only Un_buffered a file on a CD-ROM to read the files. I had to work around this problem by copying the file to the HD before fopen()'ing it.
>>
>>TIA
>
>1)
>
>Declare SHORT GetVolumeInformation IN Win32API;
>  STRING @lpRootPathName, STRING @lpVolumeNameBuffer,;
>  INTEGER nVolumeNameSize, integer @lpVolumeSerialNumber,;
>  INTEGER @lpMaximumComponentLength, INTEGER @lpFileSystemFlags,;
>  STRING @lpFileSystemNameBuffer, INTEGER nFileSystemNameSize
>
>lcRoot="c:\"
>
>Store 0 TO lncomplen, lnsysflags, lnserialno
>Store SPACE(260) TO lcvolname, lcsysname
>Store LEN(lcvolname) TO lnvolsize, lnnamesize
>If (GetVolumeInformation(@lcRoot, @lcvolname,;
>    lnvolsize, @lnserialno, @lncomplen, @lnsysflags,;
>    @lcsysname, lnnamesize) # 0)
>  ? substr(lcvolname, 1, at(chr(0),lcvolname)-1)
>Endif
>
>
>2) fopen() without 2nd parameter. ie: fopen('c:\myfile.txt')
>Instead of fopen() you could use FileToStr() with VFP6 and later.
>Cetin
Jeff Pearce
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform