Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collect Specifications from PC

Status
Not open for further replies.

Padstar

Programmer
May 4, 2005
2
GB
Howdy,

Using Excel VBA I would like to collect three pieces of information from the users computer. CPU speed, Pentium version, and RAM size.

Can I use APIs in my code to collect this info quickly and easily?

Thanks in advance
 
Have found solution

Option Explicit
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type

Public Sub SystemInfo()
Dim SI As SYSTEM_INFO
Dim MS As MEMORYSTATUS

GetSystemInfo SI
GlobalMemoryStatus MS

MsgBox "Total Memory: " & MS.dwTotalPhys / 1024 & "K" & vbNewLine _
& "Processor Type: " & SI.dwProcessorType

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top