[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to get PC hardware configuration details.

Posted on 2006-05-13
10
Medium Priority
?
614 Views
Last Modified: 2008-02-26
Some Microsoft apps determine the hardware configuration of the PC they are being installed on in order to prevent users from installing multiple copies. I would like to do the same for my Access apps.

How can you determine the hardware configuration details of a PC? The more info I can get about the configuration, the better.
0
Comment
Question by:Milewskp
8 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 672 total points
ID: 16675349
Check the sample database 11-13.mdb from the Access Cookbook:
http://www.oreilly.com/catalog/accesscook2/ (select the Examples link and follow CDROM)
The Chapter 11 zip holds it.

Nic;o)
0
 
LVL 1

Author Comment

by:Milewskp
ID: 16675392
Hi Nico,
Thanks pretty good, but I'm was hoping to get more information on the hardware components; eg., the make and model of the:
- CPU
- Disk drives
- hard drive
- etc

That is, the information that you see in the Device Manager panel (Control Panel/ Performance and Maintenance/ System/
Hardware/ Device manager).  :-)
0
 
LVL 54

Expert Comment

by:nico5038
ID: 16675435
Diskdrives is in sample 11-12.mdb :-)

CPU I haven't found yet, but I'll keep searching :-)

The same booksamples holds however in chapter 4 (sample: 04-10.mdb) a way to secure your .mdb on userlevel....

Nic;o)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 664 total points
ID: 16682999
So whats left to get? just the CPU
I can help u with that, anymore let me know, I (and Nico) will see what we can do

paste this code in a module, then run the code  GetCPUDetails

let me know what you think !!!

Just one thing, I havent run this on a AMD machine yet, just Intel but it should work as it checks for different manufacturers





Option Compare Database

'Flags for GetSystemInfo
Private Const PROCESSOR_INTEL_386 As Long = 386
Private Const PROCESSOR_INTEL_486 As Long = 486
Private Const PROCESSOR_INTEL_PENTIUM As Long = 586
Private Const PROCESSOR_MIPS_R4000 As Long = 4000
Private Const PROCESSOR_ALPHA_21064 As Long = 21064
Private Const PROCESSOR_PPC_601 As Long = 601
Private Const PROCESSOR_PPC_603 As Long = 603
Private Const PROCESSOR_PPC_604 As Long = 604
Private Const PROCESSOR_PPC_620 As Long = 620
Private Const PROCESSOR_HITACHI_SH3 As Long = 10003    'Windows CE
Private Const PROCESSOR_HITACHI_SH3E As Long = 10004   'Windows CE
Private Const PROCESSOR_HITACHI_SH4 As Long = 10005    'Windows CE
Private Const PROCESSOR_MOTOROLA_821 As Long = 821     'Windows CE
Private Const PROCESSOR_SHx_SH3 As Long = 103          'Windows CE
Private Const PROCESSOR_SHx_SH4 As Long = 104          'Windows CE
Private Const PROCESSOR_STRONGARM As Long = 2577       'Windows CE - 0xA11
Private Const PROCESSOR_ARM720 As Long = 1824          'Windows CE - 0x720
Private Const PROCESSOR_ARM820 As Long = 2080          'Windows CE - 0x820
Private Const PROCESSOR_ARM920 As Long = 2336          'Windows CE - 0x920
Private Const PROCESSOR_ARM_7TDMI As Long = 70001      'Windows CE

Private Const PROCESSOR_ARCHITECTURE_INTEL As Long = 0
Private Const PROCESSOR_ARCHITECTURE_MIPS As Long = 1
Private Const PROCESSOR_ARCHITECTURE_ALPHA As Long = 2
Private Const PROCESSOR_ARCHITECTURE_PPC As Long = 3
Private Const PROCESSOR_ARCHITECTURE_SHX As Long = 4
Private Const PROCESSOR_ARCHITECTURE_ARM As Long = 5
Private Const PROCESSOR_ARCHITECTURE_IA64 As Long = 6
Private Const PROCESSOR_ARCHITECTURE_ALPHA64 As Long = 7
Private Const PROCESSOR_ARCHITECTURE_UNKNOWN   As Long = &HFFFF&

Private Const PROCESSOR_LEVEL_80386 As Long = 3
Private Const PROCESSOR_LEVEL_80486 As Long = 4
Private Const PROCESSOR_LEVEL_PENTIUM As Long = 5
Private Const PROCESSOR_LEVEL_PENTIUMII As Long = 6

Private Const sCPURegKey = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"

Private Const HKEY_LOCAL_MACHINE As Long = &H80000002

Private Type SYSTEM_INFO
   dwOemID As Long
   dwPageSize As Long
   lpMinimumApplicationAddress As Long
   lpMaximumApplicationAddress As Long
   dwActiveProcessorMask As Long
   dwNumberOfProcessors As Long
   dwProcessorType As Long
   dwAllocationGranularity As Long
   wProcessorLevel As Integer
   wProcessorRevision As Integer
End Type

Private Declare Sub GetSystemInfo Lib "kernel32" _
   (lpSystemInfo As SYSTEM_INFO)

Private Declare Function RegCloseKey Lib "advapi32" _
   (ByVal hKey As Long) As Long

Private Declare Function RegOpenKey Lib "advapi32" _
   Alias "RegOpenKeyA" _
  (ByVal hKey As Long, _
   ByVal lpSubKey As String, _
   phkResult As Long) As Long

Private Declare Function RegQueryValueEx Lib "advapi32" _
   Alias "RegQueryValueExA" _
  (ByVal hKey As Long, _
   ByVal lpValueName As String, _
   ByVal lpReserved As Long, _
   lpType As Long, _
   lpData As Any, _
   lpcbData As Long) As Long
   

Public Sub GetCPUDetails()

   Dim SI As SYSTEM_INFO
   Dim tmp As String
   
   Call GetSystemInfo(SI)
   
   MsgBox "Number Of Processors : " & SI.dwNumberOfProcessors
   
   Select Case SI.dwProcessorType
      Case PROCESSOR_INTEL_386: tmp = "386"
      Case PROCESSOR_INTEL_486: tmp = "486"
      Case PROCESSOR_INTEL_PENTIUM: tmp = "Pentium"
      Case PROCESSOR_MIPS_R4000: tmp = "MIPS 4000"
      Case PROCESSOR_ALPHA_21064: tmp = "Alpha"
   End Select

   MsgBox "Processor Type : " & SI.dwProcessorType & vbCrLf & tmp

   Select Case SI.wProcessorLevel
      Case PROCESSOR_LEVEL_80386: tmp = "Intel 80386"
      Case PROCESSOR_LEVEL_80486: tmp = "Intel 80486"
      Case PROCESSOR_LEVEL_PENTIUM: tmp = "Intel Pentium"
      Case PROCESSOR_LEVEL_PENTIUMII: tmp = "Intel Pentium Pro, II, III or 4"
   End Select
   
   MsgBox "Processor Level : " & SI.wProcessorLevel & vbCrLf & tmp
   
   MsgBox "Processor Revision : " & SI.wProcessorRevision & vbCrLf & _
          "Model : " & HiByte(SI.wProcessorRevision) & vbCrLf & _
          "Stepping : " & LoByte(SI.wProcessorRevision)

   MsgBox "CPU Speed : " & GetCPUSpeed() & " MHz"

End Sub


Private Function GetCPUSpeed() As Long
   
   Dim hKey As Long
   Dim cpuSpeed As Long
   
  'Open CPU key
   Call RegOpenKey(HKEY_LOCAL_MACHINE, sCPURegKey, hKey)
                   
  'and retrieve the value
   Call RegQueryValueEx(hKey, "~MHz", 0, 0, cpuSpeed, 4)
   Call RegCloseKey(hKey)
   
   GetCPUSpeed = cpuSpeed

End Function


Public Function HiByte(ByVal wParam As Integer) As Byte
   
  'note: VB4-32 users should declare this function As Integer
   HiByte = (wParam And &HFF00&) \ (&H100)

End Function


Public Function LoByte(ByVal wParam As Integer) As Byte

  'note: VB4-32 users should declare this function As Integer
   LoByte = wParam And &HFF&

End Function


0
 
LVL 9

Assisted Solution

by:ajkamp
ajkamp earned 664 total points
ID: 16683297
Would 'Environ("Processor_Identifier")' be sufficient?

On my box this is the result: x86 Family 15 Model 3 Stepping 4, GenuineIntel
0
 
LVL 1

Author Comment

by:Milewskp
ID: 16764567
nico,
I checked out sample 11-12.mdb. All I could see what the drive letters (eg C, D, etc? Is this what you meant by disk drive ID?
I looked for 04-10.mdb, but it only goes up to 4-9.mdb.
0
 
LVL 54

Expert Comment

by:nico5038
ID: 16764872
11-12: Correct,it's in the text that you can use the GetVolumeInformation for more information.
04-10: Is a text paragraph and I took the window from the Wrkgadm.exe as being part ofa sample :-(
It's a feature for creating a unique identifier based on the Workgroup ID.

Nic;o)
0
 
LVL 1

Author Comment

by:Milewskp
ID: 16824163
I've found a few internet sites that show you how to get the manufacturer's serial number (not the serial number of the volume, which changes when you reformat) for the hard drives of a PC; eg    
         http://www.codeproject.com/csharp/hard_disk_serialNo.asp

But these methods are coded in vb.net. Does anyone know how to do it in vba?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question