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

Possibly Related Threads…
Thread Author Replies Views Last Post
  QB64PE Excel-type spreadsheet supporting formulas and QB64PE macros? madscijr 33 1,606 01-30-2026, 12:28 AM
Last Post: madscijr
  Variable length type declarations dano 5 706 08-06-2025, 09:53 PM
Last Post: dano
  TYPE and CONST within SUB/FUNCTION TerryRitchie 9 1,999 07-11-2023, 01:22 AM
Last Post: bplus
Question compile speed/options? BlameTroi 5 1,344 06-05-2023, 06:08 AM
Last Post: mnrvovrfc
  REDIM, TYPE, and STRING Woes TerryRitchie 16 3,215 04-13-2023, 05:17 AM
Last Post: DSMan195276

Forum Jump:


Users browsing this thread: 1 Guest(s)