Using unmanaged C++ on a Windows platform, is there a simple way to detect the number of processor cores my host machine has?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use GetLogicalProcessorInformation to get the info you need.
ETA:
As mentioned in the question a commenter linked to, another (easier) way to do it would be via GetSystemInfo:
Seems like GetLogicalProcessorInformation would give you more detailed info, but if all you need is the number of processors, GetSystemInfo would probably work just fine.