Hi,
What's the method for getting info from the system/pc.
eg: processor/memory/hardware etc in a VB5 application?
Anybody help?
Printable View
Hi,
What's the method for getting info from the system/pc.
eg: processor/memory/hardware etc in a VB5 application?
Anybody help?
With the part about the processor and the memory, I can help you. To obtain information about the processor and memory, you can use the API subroutint GetSystemInfo.
I'll give you a few sites you can visit for more information:
http://support.microsoft.com/support.../Q161/1/51.asp
http://www.gironet.nl/home/gtgkup/vb/getsysteminfo.html
http://www.mvps.org/vbnet/code/system/getsysteminfo.htm
For more information about API function and subroutines, you can download an API guide from
http://www.allapi.net/
This will give you information about a lot of functions
Hope this helps
There is also an ActiveX control you can use (if you don't mind adding an other control to your form).
It's called Microsoft SysInfo Control.
With this control you can forexample see the battery status on a laptop, the current working area adjusted for the taskbar and more.
Best regards
To get information about your platform and diskspace:
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