Page 1 of 1

getSystemInfo

Posted: Mon Jul 28, 2003 7:14 pm
by cecilcheah
In the WinAPI, getSystemInfo is a subroutine rather than a function, how can i retireve say the CPU speed with the getSystemInfo?

Thanks

Cecil

Posted: Tue Jul 29, 2003 1:59 pm
by freak
You just pass the pointer to a SYSTEM_INFO Structure to the GetSystemInfo_()
function, and it fills the structure with information.

GetSystemInfo_(@info.SYSTEM_INFO)

now the info structure contains all information.
However, i don't see how you want to get the CPU speed out of this.
As far a I can see, this structure doesn't contain information about this.

Timo

Posted: Tue Oct 07, 2003 11:11 pm
by PureUser
imho the best way is to use SRGET library for PB... there are lots of opts..:) Just search it on PB forums and resources site.. Besides there are a lot of libs for such tasks ;)

Posted: Tue Sep 14, 2004 9:49 pm
by GeoTrail
What am I doing wrong here?

Code: Select all

Structure SysInfo
  dwOemId.w
  wProcessorArchitecture.w
  wReserved.w
  dwPageSize.w
  lpMinimumApplicationAddress.l
  lpMaximumApplicationAddress.l
  dwActiveProcessorMask.w
  dwNumberOfProcessors.w
  dwProcessorType.w
  dwAllocationGranularity.w
  wProcessorLevel.w
  wProcessorRevision.w
EndStructure

GetSystemInfo_(@wProcessorArchitecture.SysInfo)
Debug PeekS(@wProcessorArchitecture)
I also tried this

Code: Select all

*Result = GetSystemInfo_(@wProcessorArchitecture.SysInfo)
Debug PeekS(*Result)
but it doesn't return anything.

Posted: Tue Sep 14, 2004 10:39 pm
by Paul
My take on it would be something like this...

Code: Select all

Structure SysInfo
  StructureUnion 
    dwOemId.l
    wProcessorArchitecture.w 
    wReserved.w 
  EndStructureUnion 
  dwPageSize.l 
  lpMinimumApplicationAddress.l 
  lpMaximumApplicationAddress.l 
  dwActiveProcessorMask.l 
  dwNumberOfProcessors.l 
  dwProcessorType.l 
  dwAllocationGranularity.l 
  wProcessorLevel.w
  wProcessorRevision.w
EndStructure

GetSystemInfo_(@si.SysInfo)


Debug si\wProcessorArchitecture
Debug "---"
Debug si\dwPageSize
Debug si\dwActiveProcessorMask
Debug si\dwNumberOfProcessors
Debug si\dwProcessorType
Debug si\wProcessorLevel
If running on a PC, wProcessorArchitecture would return 0 since #PROCESSOR_ARCHITECTURE_INTEL=0


Warning: don't use PB's built in structure for SYSTEM_INFO since it contains spelling errors and is missing the union.


And as Freak said, there is no processor speed info available in this.

Posted: Tue Sep 14, 2004 11:58 pm
by GeoTrail
Great.
Thanks alot Paul :)