Jump to content
Xtreme .Net Talk

Recommended Posts

Guest hasnain_razwi
Posted

hi. im using an API to calculate the free space on my hard disk. this is the line that i use to call the API: -

 

lngReturn = GetDiskFreeSpace(strDrive, lngSectorPerCluster, lngBytesPerSector, lngFreeClusters, lngTotalClusters)

 

where the value of strDrive is "C:/ ". the trouble is no matter what value i put in strDrive, i keep getting the same result for the rest of the parameters i.e 0,0,0,0. (ofcourse thats not right :mad: ) and since there isnt any error, i cant tell where the mistake is.

 

one more thing, is there an API viewer like application like the one available in VB 6 where we could copy the declaration code from the viewer window and paste it into the code?

Guest hasnain_razwi
Posted
How have you declared the API? does it work with "C:\"?

 

nope stil doesnt

it doesnt even give me an error when i put in an empty string. just doesnt work. the declaration is as follows :-

 

Public Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, ByVal lpSectorsPerCluster As Long, ByVal lpBytesPerSector As Long, ByVal lpNumberOfFreeClusters As Long, ByVal lpTotalNumberOfClusters As Long) As Long

Posted
Have you tryied DllImport ?

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Guest hasnain_razwi
Posted
thanks..it did work that way :D
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...