Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

FSO gives wrote TotalSize

Posted on 2000-03-16
11
Medium Priority
?
213 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
Industry Leaders: 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!

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses

650 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