Results 1 to 5 of 5

Thread: how to get info about my comp.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Question

    i want to get info about my system :
    (freediskspace,globlsize,OperatingSystem,OperatingSysVer,
    VirtualDisks...)

    how can i get all that info by API function.
    The MORE I get to know,
    I realize that I know NOTHING !

  2. #2
    Junior Member
    Join Date
    Jul 2000
    Location
    Antwerp,Belgium
    Posts
    21
    Following site offers an overview of the most common used api functions:
    http://www.vbapi.com

    Or if you want good examples:
    http://www.mvps.org/vb/

    I know for certain that you can use
    GetDiskFreeSpaceEx to obtain the free disk space

    I hope this helps

  3. #3
    Guest
    Try this. Put this code into a Form with a CommandButton.

    Code:
    Private Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
    Private Declare Function GetDiskFreeSpaceEx Lib "kernel32.dll" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As ULARGE_INTEGER, lpTotalNumberOfBytes As ULARGE_INTEGER, lpTotalNumberOfFreeBytes As ULARGE_INTEGER) As Long
    Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
    
    Private Type ULARGE_INTEGER
      LowPart As Long
      HighPart As Long
    End Type
    
    Private Type OSVERSIONINFO
      dwOSVersionInfoSize As Long
      dwMajorVersion As Long
      dwMinorVersion As Long
      dwBuildNumber As Long
      dwPlatformId As Long
      szCSDVersion As String * 128
    End Type
    
    Dim OsInfo As OSVERSIONINFO
    Dim tmp As String
    Dim FreeUser As ULARGE_INTEGER
    Dim Total As ULARGE_INTEGER
    Dim FreeSys As ULARGE_INTEGER
    Dim Temp As Currency
    Dim fTemp As Currency
    
    Private Sub Command1_Click()
    
        'Get OS Info
        OsInfo.dwOSVersionInfoSize = Len(OsInfo)
        retval = GetVersionEx(OsInfo)
        
        Select Case OsInfo.dwPlatformId
            Case 0
                tmp = "Windows 3.x"
            Case 1
                tmp = "Windows 95/98"
            Case 2
                tmp = "Windows NT"
        End Select
        
        Print "Version: " & OsInfo.dwMajorVersion & "." & OsInfo.dwMinorVersion
        Print "Build: " & OsInfo.dwBuildNumber
        Print "Platform: " & tmp
      
        'Get DiskSpace
        GetDiskFreeSpaceEx "C:\", FreeUser, Total, FreeSys
        CopyMemory Temp, Total, 8
        CopyMemory fTemp, FreeUser, 8
        Print "Total Space: " & (CCur(Temp) * 10000) / 1000000000 & " GB"
        Print "Free Space: " & (CCur(fTemp) * 10000) / 1000000000 & " GB"
        
    End Sub

  4. #4
    Guest
    If you want to view info like from System Information.

    Code:
    Shell "C:\Program Files\Common Files\Microsoft Shared\MSINFO\MSINFO32.EXE", VbNormalFocus

  5. #5
    Guest
    The SysInfo Control will also work, but the API method is a little more flexible.

    Code:
    Private Sub Command1_Click()
    
        'Print the version of the OS
        Print SysInfo1.OSVersion
        
    End Sub

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