首页 > 代码库 > win32系统信息获取
win32系统信息获取
1 #include <Windows.h> 2 #include "resource.h" 3 #include <strsafe.h> 4 5 6 PTSTR BigNumToString(LONG lNum, PTSTR szBuf, DWORD chBufSize) 7 { 8 TCHAR szNum[100]; 9 StringCchPrintf(szNum,_countof(szNum),TEXT("%d"),lNum);10 11 NUMBERFMT nf;12 nf.NumDigits = 0;13 nf.LeadingZero = FALSE;14 nf.Grouping = 3;15 nf.lpDecimalSep = TEXT(".");16 nf.lpThousandSep = TEXT(",");17 nf.NegativeOrder = 0;18 GetNumberFormat(LOCALE_USER_DEFAULT,0,szNum,&nf,szBuf,chBufSize);19 20 return szBuf;21 }22 23 INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)24 {25 BOOL bRet = TRUE;26 27 switch(uMsg)28 {29 case WM_INITDIALOG:30 31 SYSTEM_INFO sinf;32 GetSystemInfo(&sinf);33 34 TCHAR szBuf[50];35 36 SetDlgItemText(hDlg,IDC_PAGESIZE,BigNumToString(sinf.dwPageSize,szBuf,_countof(szBuf)));37 38 StringCchPrintf(szBuf,_countof(szBuf),TEXT("%p"),sinf.lpMinimumApplicationAddress);39 SetDlgItemText(hDlg,IDC_MINAPPADDR,szBuf);40 StringCchPrintf(szBuf,_countof(szBuf),TEXT("%p"),sinf.lpMaximumApplicationAddress);41 SetDlgItemText(hDlg,IDC_MAXAPPADDR,szBuf);42 43 SetDlgItemText(hDlg,IDC_ALLOCGRAN,BigNumToString(sinf.dwAllocationGranularity,szBuf,_countof(szBuf)));44 45 break;46 case WM_CLOSE:47 EndDialog(hDlg,0);48 break;49 default:50 bRet = FALSE;51 break;52 }53 54 return bRet;55 }56 57 int APIENTRY wWinMain(HINSTANCE hInstance,58 HINSTANCE hPrevInstance,59 LPTSTR lpCmdLine,60 int nCmdShow)61 {62 DialogBox(hInstance,MAKEINTRESOURCE(IDD_MAIN),NULL,MainDlgProc);63 return 0;64 }
win32系统信息获取
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。