?
Solved

FSO gives wrote TotalSize

Posted on 2000-03-16
11
Medium Priority
?
211 Views
Last Modified: 2008-03-04
I'm trying to write a little app to give FreeSpace/TotalSize for my HDs

The HDs are around 2.5, 3.5 and 3, but Total size always gives around 1.99

What am I missing? The drives are Fat32 and I'm using VB6 sp3 and scrrun.dll is 5.1.0.4615

PC is using Win98
0
Comment
Question by:JOK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 3

Author Comment

by:JOK
ID: 2625709
..sorry, should be "wrong TotalSize"

maybe I should check my code for a typo ;)
0
 
LVL 9

Accepted Solution

by:
Ruchi earned 436 total points
ID: 2625714
GetDiskFreeSpaceEX API is for getting the total space of hard drive -- more than 2 GB

Option Explicit

Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
Private Function GetFreeSpace(pDrive As String) As String
    Dim curTotalBytes As Currency
    Dim curFreeBytesToCaller As Currency
    Dim curTotalFreeBytes As Currency
     
    Call GetDiskFreeSpaceEx(pDrive, curFreeBytesToCaller, curTotalBytes, curTotalFreeBytes)
    GetFreeSpace = Format$(curTotalBytes * 10000, "###,###,###,##0")
End Function

Private Sub Form_Load()
MsgBox "Free space on drive C: is: " & GetFreeSpace("C:")
End Sub
0
 
LVL 3

Author Comment

by:JOK
ID: 2625740
I hate fast answers. Makes me feel dumber than I am.

It worked.

I couldn't find anything on msdn. Guess I didn't know what to search for.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Author Comment

by:JOK
ID: 2625743
You've got the points already, but what about for available space. Would using FSO work or is there the same limit?
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2625746
Thank you very much, JOK, for the points! I am glad that I could be of any help to you! Again, thanks!

Just logged on a few minutes ago. ;-)
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2625755
Yes.....

Increase more points!! ;-)

Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
Private Function GetFreeSpace(pDrive As String) As String
    Dim curTotalBytes As Currency
    Dim curFreeBytesToCaller As Currency
    Dim curTotalFreeBytes As Currency
    Call GetDiskFreeSpaceEx(pDrive, curFreeBytesToCaller, curTotalBytes, curTotalFreeBytes)
    GetFreeSpace = Format$(curTotalFreeBytes * 10000, "###,###,###,##0")
End Function

Private Sub Command1_Click()
MsgBox "Free space on drive C: is: " & GetFreeSpace("C:")
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2625806
JOK,
Just kidding about increasing more point! Anyway, did you get working for available space on your hard drive? Please let me know. Thank you very much.
0
 
LVL 3

Author Comment

by:JOK
ID: 2628439
Looks like its working for both.

I've used FSO with ASP and it seems to work properly.

I can give you more points if you can tell me if, in fact it does work with ASP, or why it doesn't.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2629590
JOK: I don't know anything about ASP. I really can't help you with this ASP question. Sorry.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2629601
ASP - Active Server Page? I am not a web developer.
0
 
LVL 3

Author Comment

by:JOK
ID: 2631348
With ASP, you can us VBScript which is a "subset" of VB. FSO is FileSystemObject, and you can use it with VB or VBScript.

Oh well. I really appreciate your help, 'tho.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question