CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Hard disk info

  1. #1
    Join Date
    Feb 2000
    Posts
    6

    Hard disk info

    I would like to known how I can found all hard disk on a machine, for every one I search : - the global capacity
    - all infos


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Hard disk info

    If you use VB6 (or VB5 with the free Microsoft Scripting control from http://msdn.microsoft.com/scripting) - you can use the Scripting RunTime DLL (SCRRUN.DLL) and the FileSystemObject to query this information.

    For Example:

    1. Set a reference to Microsoft Scripting Run-Time from the Project->References menu in VB

    2. Paste the following code into a form with a Button (Command1)



    private Sub Command1_Click()
    '
    Dim oDrive as Drive
    Dim oFSO as FileSystemObject
    '
    set oFSO = new FileSystemObject
    '
    for Each oDrive In oFSO.Drives
    Debug.print oDrive.DriveLetter & " " & _
    oDrive.AvailableSpace & " " & oDrive.TotalSize
    '
    next
    End Sub





    You might want to checkout the other properties of the Drive object (and all the others that come with the Scripting Host - it's very useful).


    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured