09-09-2022, 07:55 PM
(This post was last modified: 09-09-2022, 09:23 PM by SpriggsySpriggs.)
The below snippet will show the amount of RAM your computer currently has installed.
Code: (Select All)
Option Explicit
$NoPrefix
$Console:Only
Const KILOBYTE = 1024
Const MEGABYTE = 1024 ^ 2
Const GIGABYTE = 1024 ^ 3
Const TERABYTE = 1024 ^ 4
Declare Dynamic Library "Kernel32"
Sub GetPhysicallyInstalledSystemMemory (ByVal TotalMemoryInKilobytes As Offset)
End Declare
Dim As Unsigned Integer64 memory
GetPhysicallyInstalledSystemMemory Offset(memory)
memory = memory * KILOBYTE
Select Case memory
Case Is < KILOBYTE
Print Using " #### B"; memory
Case Is < (MEGABYTE) And memory >= KILOBYTE
Print Using "####.## KB"; (memory / KILOBYTE)
Case Is < (GIGABYTE) And memory >= (MEGABYTE)
Print Using "####.## MB"; (memory / (MEGABYTE))
Case Is < (TERABYTE) And memory >= (GIGABYTE)
Print Using "####.## GB"; (memory / (GIGABYTE))
End Select
Ask me about Windows API and maybe some Linux stuff