Jump to content

Help me with some functions?


Recommended Posts

Hey guys, I'm making my first GUI and it is mostly a trial-and-error process. Anyways, I want to make a program that can be used to find all of the things about your computer. RAM, Videocard, ect... So far i have the biggest, ugliest, GUI you can imagine. But visuals come later. I was just wondering where the best place for me to find the functions for what I want to do.

My code so far:

#include <GUIConstants.au3>

Global $GUIWidth
Global $GUIHeight

$GUIWidth = 500
$GUIHeight = 500
$mem = MemGetStats()

$MYGUI = GUICreate ("System Specs", $GUIWidth, $GUIHeight)
GUISetState()

$Findrambtn = GUICtrlCreateButton ( "Calculate Ram", 25, 25 , 100 , 50)

Do
    
    $msg = GUIGetMsg()
    
    Select 
    Case $msg = $Findrambtn
        MsgBox(0, "Total physical RAM (KB):", $mem[1])
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

As you can see, all it can do so far is calculate your ram. So how about it? Any functions for other things?

Link to comment
Share on other sites

Adding a calculate CPU speed function. But remember, I'm new to autoit so I have another question, I know that CPU speed can be found at HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\~MHZ but how would i show the results of that?

Link to comment
Share on other sites

I made two examples for you, the first one is simple and reads the first cores value, the second reads all the cores and saves them in an array :)

; Known Single core
$mhz = RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz")
MsgBox(0, "", $mhz & " MHz")

; Unknown number of cores
Dim $array[1], $string
$i = 1
While 1
    $key = RegEnumKey("HKML\HARDWARE\DESCRIPTION\System\CentralProcessor\", $i)
    If @error Then ExitLoop
    $array[0] += 1
    ReDim $array[UBound($array) + 1]
    $array[UBound($array) - 1] = RegRead("HKML\HARDWARE\DESCRIPTION\System\CentralProcessor\" & $key, "~MHz")
    $i += 1
WEnd
For $j = 1 To UBound($array) - 1
    $string &= "Core " & $j - 1 & ": " & $array[$j] & " Mhz" & @CRLF
Next
MsgBox(0, $array[0] & " cores found", $string)
Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...