BOOL CheckResource() { MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); GlobalMemoryStatusEx(&statex); if (statex.ullTotalPhys / 1024 / 1024 / 1024 < 2){ ::MessageBox(NULL, L"物理内存小于 2G", L"提示", MB_ICONWARNING); return 0; } if (statex.ullAvailPhys / 1024 / 1024 /1024 < 1){ ::MessageBox(NULL, L"物理有效内存小于 1G", L"提示", MB_ICONWARNING); return 0; } ULARGE_INTEGER lpFreeBytesAvailable; ULARGE_INTEGER lpTotalNumberOfBytes; ULARGE_INTEGER lpTotalNumberOfFreeBytes; GetDiskFreeSpaceEx(NULL, &lpFreeBytesAvailable, &lpTotalNumberOfBytes, &lpTotalNumberOfFreeBytes); if (lpTotalNumberOfFreeBytes.QuadPart / 1024 / 1024 / 1024 < 50){ ::MessageBox(NULL, L"磁盘有效空间小于 50G", L"提示", MB_ICONWARNING); return 0; } return TRUE; }
时间: 2024-12-21 19:29:06