Windows API one-day training (74) getsysteminfo Function

Source: Internet
Author: User
Windows API one-day training (74) getsysteminfo Function

On one occasion, I was developing a video compression program, and the compression algorithm was very efficient, that is, the multimedia instruction that needed to use the CPU. In the x86 field, there are currently two major CPUs: Intel and AMD. Their multimedia commands are different. To distinguish such different commands, you need to call the getsysteminfo function to obtain CPU information, and then call different dynamic connection libraries for multimedia data compression.

The getsysteminfo function is declared as follows:

Winbaseapi
Void
Winapi
Getsysteminfo (
_ Out lpsystem_info lpsysteminfo
);

Lpsysteminfo is the structure of the returned hardware information.

An example of calling a function is as follows:
#001 //
#002 // obtain the hardware information of the current system.
#003 // Cai junsheng 2007/11/15 QQ: 9073204 Shenzhen
#004 void gethardinfo (void)
#005 {
#006 //
#007 system_info sysinfo;
#008
#009 // obtain system information.
#010: getsysteminfo (& sysinfo );
#011
#012 // display the information of the current system.
#013 //
#014 const int nbufsize = 512;
#015 tchar chbuf [nbufsize];
#016 zeromemory (chbuf, nbufsize );
#017
#018 wsprintf (chbuf, _ T ("oem id: % u/N"), sysinfo. dwoemid );
#019 outputdebugstring (chbuf );
#020
#021 wsprintf (chbuf, _ T ("CPU count: % u/N"), sysinfo. dwnumberofprocessors );
#022 outputdebugstring (chbuf );
#023
#024 wsprintf (chbuf, _ T ("memory paging size: % u/N"), sysinfo. dwpagesize );
#025 outputdebugstring (chbuf );
#026
#027 wsprintf (chbuf, _ T ("CPU type: % u/N"), sysinfo. dwprocessortype );
#028 outputdebugstring (chbuf );
#029
#030 wsprintf (chbuf, _ T ("CPU architecture: % u/N"), sysinfo. wprocessorarchitecture );
#031 outputdebugstring (chbuf );
#032
#033 wsprintf (chbuf, _ T ("CPU level: % u/N"), sysinfo. wprocessorlevel );
#034 outputdebugstring (chbuf );
#035
#036 wsprintf (chbuf, _ T ("CPU version: % u/N"), sysinfo. wprocessorrevision );
#037 outputdebugstring (chbuf );
#038
#039}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.