PDA

View Full Version : cpu detection ?



Lionheart008
30-07-2009, 20:01
hi all,

what possibilities I have with thinbasic to get system infos ? e.g. about CPU frequency, detection or hardware infos ? do any example for this cases already exist ?

my idea:


uses "liongfx", "console"
dim tb_CpuDetect as long

liongfx_screen 16,32

Function cpu_type() As Integer '4 = 486er, 5 = 586er 6 = 686er etcpp.
Function = tb_CpuDetect liongfx_Shr, 28,0
End Function

liongfx_Print "your CPU-Typ = " & cpu_type() & " 86 "

liongfx_Print
liongfx_Sleep 1500

what library I can use ? somebody can help with a link or infos ? would be very nice...
something like this one:


LIB "KERNEL32.DLL"

good evening, lionheart

Petr Schreiber
30-07-2009, 20:17
Hi Frank,

there are 2 approaches at least.
The classic is via assembly (and for this there is only one dark master, Charles :) )

The second is high level, via WMI, should work from Windows XP up:


uses "WMI"
uses "OS"
uses "CONSOLE"

dim vData() as string
dim nItems as long
dim Counter as long
dim ComputerName as string value OS_GetComputerName
dim sBuffer as string

'---Ask data to WMI system
printl "Brief info"
sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_Processor", "", "Name, MaxClockSpeed" )

'---Parse returned data into single lines
nItems = PARSE( sBuffer, vData(), $crlf)

'---Print lines
for Counter = 1 to nItems
console_writeline vData(Counter)
next

printl "Press any key for brutal info :D"
waitkey
sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_Processor", "", "" )

'---Parse returned data into single lines
nItems = PARSE( sBuffer, vData(), $crlf)

'---Print lines
for Counter = 1 to nItems
console_writeline vData(Counter)
next


'---Finished
printl "---------------------------Press a key to finish-----"
waitkey

Lionheart008
30-07-2009, 20:40
hi petr, that's simply perfect ! :)

sorry, have deleted my post, was rubbish...

thank you, good evening, now I quit for watching soccer in munich :D
(tv channel zdf: fc bayern munich ./. manchester united, audi cup 2009)

lionheart
ps: fc bayern munich has won the audi cup by penalty shooting 7:6 !

Charles Pegge
31-07-2009, 05:59
Hi Frank,

Petr's program above provides more useful information than my CPU stuff, though this could be useful for checking the capabilities of ancient CPUs or some of the more recent cut-down versions eg VIA technologies. My Linux box runs on one of these http://www.via.com.tw/en/index.jsp

Charles