Solved

DiskFreeSpace

Posted on 2001-08-03
4
163 Views
Last Modified: 2011-10-03
How do i get the free space of a server on the network?
(It demands a password)

Second ,  i saw many times a $ sign after a name of a variable , what is it for?
0
Comment
Question by:itzikb
[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
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6350613
a $ sign after the name hard sets the variable to a string

Dim x

x$ = "This is a string"

So essentially, x was dimmed as a variant.  Then forcing it to become a string data type.  There are others for other datatypes, but I'd have to look them up... Some people use them for no apparent reason...

Dim x as string

x$ = "This is a string"

"This is stupid"
0
 
LVL 3

Expert Comment

by:andysalih
ID: 6350621
this will get all the information you require, but im note sure about the password side,

there will be full source code including in file.

download from

http://www.planetsourcecode.com/xq/ASP/txtCodeId.25033/lngWId.1/qx/vb/scripts/ShowCode.htm

also like prev stated

$ defines var as string

visual basic = dim var as string

basic or others = var$="anything"

denotes var can store numbers or words "string"



hope this helps

Andy
0
 
LVL 3

Accepted Solution

by:
andysalih earned 100 total points
ID: 6350626
or you could use this code, you will need to encorperate the password side in yourself.

General Declarations of Module:
'Example
'Cur_X = DiskFree("C:")
'You can use Str_Z = Format(Cur_X,"#,0")
'     to put the commas in (eg. 1,234,567)
'if Cur_X = 0 then get DiskFree failed.


Declare Function GetDiskFreeSpace_FAT16 Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As Long
    Dim SectorsPerCluster&, BytesPerSector&, NumberOfFreeClusters&, TotalNumberOfClusters&


Declare Function GetDiskFreeSpace_FAT32 Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, FreeBytesToCaller As Currency, BytesTotal As Currency, FreeBytesTotal As Currency) As Long
    Dim FreeBytesAvailable@, TotalBytes@, TotalFreeBytes@
             
' Inputs:Drive - Type String in the foll
'     owing format "X:" X = drive letter
'
' Returns:Disk Space Free returned as va
'     lue Currency.




Public Function DiskFree(Drive As String) As Currency
    Passed = GetDiskFreeSpace_FAT16(Drive, SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters)


    If Passed = 0 Then 'Not FAT16, Try FAT32
        Passed = GetDiskFreeSpace_FAT32(Drive, FreeBytesAvailable, TotalBytes, TotalFreeBytes)


        If Passed = 0 Then
            'getinfo failed, return 0, exit sub
            DiskFree = 0
            Exit Function
        End If
        DiskFree = CCur(FreeBytesAvailable) 'FAT32
        Exit Function
    End If
    DiskFree = CCur(NumberOfFreeClusters * SectorsPerCluster * BytesPerSector) 'FAT16
End Function


hope this helps my friend

cheers
Andy
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6350732
Further clarification on the "$"

"$" is the old QuickBASIC way of defining a string and was typically put in the dim statement (if the dim statement was used):

Dim A$

is identical to the "newer" (and much clearer)

Dim A as String

--
Also, $ is often used with various functions (Left$, Str$, etc.)  In this case, the results are the same as their counter-parts without the $ (Left, Str, etc.), but (I'm told) the ones with the $ are much faster becauses they explicitly use string for their caluclations rather than the slower variants.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, left to enroll

617 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