Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetVolumeInformation
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00059297
Message ID:
00059301
Vues:
26
>Help,
>
>I'm trying to use the GetVolumeInformation call in KERNAL32.
>But it only Partially succeeds. I think that I am not passing
>parameters correctly. Here's my code
>
>BEGINCODE
>
>DECLARE Integer GetVolumeInformation in Win32api;
> string, string, integer, integer @, integer @,;
> integer @, string, integer
>WITH THIS
> IF TYPE('tcRootPathName') # "L"
> .RootPathName = tcRootPathName
> ENDIF
> lcVolumeName = .VolumeName
> liVolumeNameSize = Len(.VolumeName)
> liVolSerialNumber = .VolSerialNumber
> liMaxCompLen = .MaxCompLen
> liFileSysFlags = .FileSysFlags
> lcFileSysName = .FileSysName
> liFileSysNameSize = Len(.FileSysName)
> llSuccess = GetVolumeInformation(.RootPathName,lcVolumeName,liVolumeNameSize,;
> @liVolSerialNumber,@liMaxCompLen,@liFileSysFlags,;
> lcFileSysName,liFileSysNameSize)
>ENDCODE
>
>lcVolumeName and lcFileSysName Return ---> ""
>liVolumeNameSize and liFileSysName Size Return ---> 0
>llSuccess Returns ---> 0 indicating (BOOL FALSE) Failure

Terry,

You're right, the parameters are incorrect. Here's the correct declaration

DECLARE SHORT GetVolumeInformation IN Win32API;
STRING @lpRootPathName, STRING @lpVolumeNameBuffer,;
INTEGER nVolumeNameSize, INTEGER @lpVolumeSerialNumber,;
INTEGER @lpMaximumComponentLength, INTEGER @lpFileSystemFlags,;
STRING @lpFileSystemNameBuffer, INTEGER nFileSystemNameSize


And the code for it might look something like:

lcpath = "C:\"
STORE SPACE(200) TO lcvolbuffer, lcnamebuff
STORE 200 TO lnvolsize, lnnamesize
STORE 0 TO lnmaxcomp, lnsysflags, lnserialno
llresult = GetVolumeInformation(@lcpath, @lcvolbuffer, lnvolsize, @lnserialno, @lnmaxcomp, @lnsysflags, @lcnamebuff, lnnamesize)

The reason that you were only getting some of the information back was that you weren't passing the variables by reference.

hth,

George
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