Solved

FSO gives wrote TotalSize

Posted on 2000-03-16
11
205 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

806 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