Here is the second version, because the first had some bugs as Manavo11 told already!
This version has these features:
1) CPU Usage
2) Cpu Exact model
3) Cpu identifier
4) Total Memory
5) Free Memory
6) Operating System Name
7) Operating System Exact Version
Now, its name should be changed, because it is not only CPU information! It has information for Memory and Operating System also, so, it's like a system Information utility!
By the way, you can use this to get the decimal point of the computer that your app is running on and avoid the error
VB Code:
Option Explicit
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Const LOCALE_USER_DEFAULT = &H400
Const LOCALE_SDECIMAL As Long = &HE
Private Sub Form_Load()
MsgBox "Decimal point character : " & GetInfo(LOCALE_SDECIMAL)
End Sub
Private Function GetInfo(ByVal lInfo As Long) As String
Dim Buffer As String, Ret As String
Buffer = String$(256, 0)
Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer))
If Ret > 0 Then
GetInfo = Left$(Buffer, Ret - 1)
Else
GetInfo = ""
End If
End Function
Has someone helped you? Then you can Rate their helpful post.
Thanks Manavo11, but i prefer this way, because this i know! (It tried your way, and it works perfect)
You prefer what way? The one that might cause an error? BTW, a simpler way would be to use Int or CInt instead of InStr to get the integer part of the number
Has someone helped you? Then you can Rate their helpful post.
Int and CInt are functions that return the Integer part of a number and the rounded Integer part of the number you pass as an argument to the functions. For example
VB Code:
MsgBox Int(11.6)
MsgBox CInt(11.6)
Has someone helped you? Then you can Rate their helpful post.
I use the following to return the Brand Name of the o/s:
VB Code:
Public Function getVersion() As String
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
With osinfo
Select Case .dwPlatformId
Case 1
If .dwMinorVersion = 0 Then
getVersion = "Windows 95"
ElseIf .dwMinorVersion = 10 Then
getVersion = "Windows 98"
End If
Case 2
If .dwMajorVersion = 3 Then
getVersion = "Windows NT 3.51"
ElseIf .dwMajorVersion = 4 Then
getVersion = "Windows NT 4.0"
ElseIf .dwMajorVersion = 5 And .dwMinorVersion = 0 Then
getVersion = "Windows 2000"
ElseIf .dwMajorVersion = 5 And .dwMinorVersion = 1 Then
getVersion = "Windows XP"
End If
Case Else
getVersion = "Failed"
End Select
End With
End Function
This code will have to be updated when future o/s are released (i.e. "Longhorn")
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Wow. I know this doesn't help anyone much, but I just wanted to say thanx - this is a great program - I integrated the CPU class into my program and now it's great(er)!
Visit here to learn to make the VB interface fit you!.
"I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison
"The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners" -- Ernst Jan Plugge