GetSystemInfo函式用於獲取當前系統的信息。
基本介紹
- 中文名:GetSystemInfo
- 函式原型:void WINAPI GetSystemInfo
- 函式簡介:GetSystemInfo,Win32 API 函式
- 函式說明:返回關於當前系統的信息
函式說明,函式原型,參數表,參數說明,返回值,例子,
GetSystemInfo
GetSystemInfo,Win32 API 函式。
函式說明
GetSystemInfo返回關於當前系統的信息。
函式原型
void WINAPI GetSystemInfo(_Out_ LPSYSTEM_INFO lpSystemInfo);
參數表
參數說明
lpSystemInfo :指向一個供函式返回信息的SYSTEM_INFO結構體。
SYSTEM_INFO結構體定義如下:
typedef struct _SYSTEM_INFO{union{DWORD dwOemId;struct {WORD wProcessorArchitecture;WORD wReserved;};};DWORD dwPageSize;LPVOID lpMinimumApplicationAddress;LPVOID lpMaximumApplicationAddress;DWORD_PTR dwActiveProcessorMask;DWORD dwNumberOfProcessors;DWORD dwProcessorType;DWORD dwAllocationGranularity;WORD wProcessorLevel;WORD wProcessorRevision;} SYSTEM_INFO;
SYSTEM_INFO結構體參數說明:
wProcessorArchitecture: Word; {處理器的體系結構}
wReserved: Word; {保留}
dwPageSize: DWORD; {分頁大小}
lpMinimumApplicationAddress: Pointer;{最小定址空間}
lpMaximumApplicationAddress: Pointer;{最大定址空間}
dwActiveProcessorMask: DWORD; {處理器掩碼; 0..31 表示不同的處理器}
dwNumberOfProcessors: DWORD; {處理器數目}
dwProcessorType: DWORD; {處理器類型}
dwAllocationGranularity: DWORD; {虛擬記憶體空間的粒度}
wProcessorLevel: Word; {處理器等級}
wProcessorRevision: Word); {處理器版本}
返回值
這個函式不返回任何值。
快捷信息:
導入庫:kernel32.lib
頭檔案:winbase.h
數據類型:win 32 XPsy
例子
#include <iostream>#include <windows.h>#include <iomanip>using namespace std;int main(){ SYSTEM_INFO systemInfo; GetSystemInfo(&systemInfo); cout <<setw(20) << "處理器掩碼: " << systemInfo.dwActiveProcessorMask << endl <<setw(20) << "處理器個數: " << systemInfo.dwNumberOfProcessors << endl <<setw(20) << "處理器分頁大小: " << systemInfo.dwPageSize << endl <<setw(20) << "處理器類型: " << systemInfo.dwProcessorType << endl <<setw(20) << "最大定址單元: " << systemInfo.lpMaximumApplicationAddress << endl <<setw(20) << "最小定址單元: " << systemInfo.lpMinimumApplicationAddress << endl <<setw(20) << "處理器等級: " << systemInfo.wProcessorLevel << endl <<setw(20) << "處理器版本: " << systemInfo.wProcessorRevision << endl; return 0;}