複製鏈接
請複製以下鏈接發送給好友

GetSystemInfo

鎖定
GetSystemInfo函數用於獲取當前系統的信息。
中文名
GetSystemInfo
函數原型
void WINAPI GetSystemInfo
函數簡介
GetSystemInfo,Win32 API 函數
函數説明
返回關於當前系統的信息

GetSystemInfo函數説明

GetSystemInfo,Win32 API 函數。
GetSystemInfo返回關於當前系統的信息。

GetSystemInfo函數原型

void WINAPI GetSystemInfo
(
_Out_ LPSYSTEM_INFO lpSystemInfo
);

GetSystemInfo參數表

GetSystemInfo參數説明

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;
[1] 
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;  {處理器版本}

GetSystemInfo返回值

這個函數不返回任何值。
快捷信息:
導入庫:kernel32.lib
頭文件:winbase.h
數據類型:win 32 XPsy

GetSystemInfo例子

#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;
}
參考資料