Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CPU Type and Speed
#7
(06-09-2023, 03:35 PM)Ultraman Wrote: @TerryRitchie

Here you go.

Code: (Select All)
Option Explicit
$NoPrefix
$Console:Only

'$Include:'WinReg.BI'

Dim As Unsigned Long procSpeed
Dim As String procName

If ReadREG_SZ(HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString", procName) = REG_TRUE Then
    Print "Processor:", procName
End If
If ReadREG_DWORD(HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz", procSpeed) = REG_TRUE Then
    Print "Processor Speed:", procSpeed / 1000; "GHz"
End If

'$Include:'WinReg.BM'
[Image: image.png]
I divided by 1,000 because the value is in MHz, not GHz
Excellent! Thank you. It's as simple as looking in the registry for the info. Much easier than I imagined.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
CPU Type and Speed - by TerryRitchie - 06-07-2023, 08:26 PM
RE: CPU Type and Speed - by mnrvovrfc - 06-07-2023, 09:37 PM
RE: CPU Type and Speed - by Ultraman - 06-07-2023, 09:42 PM
RE: CPU Type and Speed - by SMcNeill - 06-07-2023, 10:22 PM
RE: CPU Type and Speed - by SMcNeill - 06-07-2023, 10:23 PM
RE: CPU Type and Speed - by Ultraman - 06-09-2023, 03:35 PM
RE: CPU Type and Speed - by TerryRitchie - 06-09-2023, 03:52 PM
RE: CPU Type and Speed - by Ultraman - 06-09-2023, 05:05 PM
RE: CPU Type and Speed - by TerryRitchie - 06-09-2023, 05:10 PM
RE: CPU Type and Speed - by Ultraman - 06-09-2023, 05:20 PM
RE: CPU Type and Speed - by Ultraman - 06-09-2023, 05:22 PM
RE: CPU Type and Speed - by TerryRitchie - 06-09-2023, 08:49 PM



Users browsing this thread: 3 Guest(s)