Solved

FSO gives wrote TotalSize

Posted on 2000-03-16
11
202 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
  • 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 109 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now