Avatar of lik
lik
 asked on

Simple example using SYSTEM_INFO in C++

Can someone share me with some simple examples using SYSTEM_INFO in C++.  I just need a simple way in C++ to returns me the level of the CPU.

Thanks,

Lik
C++

Avatar of undefined
Last Comment
lik

8/22/2022 - Mon
jkr

What do you mean by the 'level of the CPU'? If you mean 'wProcessorLevel', you'd use

SYSTEM_INFO si;

GetSystemInfo ( &si);

switch ( si.wProcessorLevel) {
 
case 3: // x386
  break;
case 4: // x486
  break;
case 5: // Pentium
  break;
}

lik

ASKER
Thanks, jkr.

I found the SYSTEM_INFO from the MSDN, and know the code you provided will do the job.  The problem I have is I don't know what to header information include to use SYSTEM_INFO.  I searched the books and the internet, but just could not find any more information regarding this.  Can you help me more?

Thanks,
lik

ASKER
Thanks, jkr.

I found the SYSTEM_INFO from the MSDN, and know the code you provided will do the job.  The problem I have is I don't know what to header information include to use SYSTEM_INFO.  I searched the books and the internet, but just could not find any more information regarding this.  Can you help me more?

Thanks,
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
lik

ASKER
I just figured out I need to @include <windows.h>

Thanks for all you pros for the help :)
ASKER CERTIFIED SOLUTION
jkr

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
lik

ASKER
Sure. This case is close :)

Thanks,
jkr

>>Sure. This case is close :)

Well, actually, on EE questions are closed by selecting one of the comments as the answer... :o)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lik

ASKER
Helped with SYSTEM_INFO