The GetSystemInfo function returns information about the current system. VOID GetSystemInfo( LPSYSTEM_INFO lpSystemInfo // address of system information structure ); ParameterslpSystemInfoPoints to a SYSTEM_INFO structure to be filled in by this function. Return ValuesThis function does not return a value. See AlsoSYSTEM_INFO
);
ParameterslpSystemInfoPoints to a SYSTEM_INFO structure to be filled in by this function. Return ValuesThis function does not return a value. See AlsoSYSTEM_INFO
windows98提供了获得剩余系统、用户、gdi资源的函数,但在msdn中并未提及--又一个未公开的函数:-)。 这个函数名为_mygetfreesystemresources32@4,隐身于rsrc32.dll文件中。函数的原型及使用方法如下文所示,注意该函数的返回值为剩余资源百分比的值,例如:如果该函数返回70,表明相应剩余资源为70%。 // 函数使用的参数
#define gfsr_systemresources 0
#define gfsr_gdiresources 1
#define gfsr_userresources 2// 函数的原型
typedef long (pascal * lpgetfreeresources)(int);
// 函数的指针
lpgetfreeresources lpgetfreeresources;
// rsrc32.dll库的实例句柄
hinstance hrsrc;// 保存剩余资源的数组
long lfree[3];// 获得mygetfreesystemresources32函数的指针
hrsrc = loadlibrary("rsrc32.dll");
if (hrsrc == null)
{
messagebox(null, "can't load rsrc32.dll!", "error", mb_ok|mb_iconstop);
return false;
}lpgetfreeresources = (lpgetfreeresources)getprocaddress(hrsrc,
"_mygetfreesystemresources32@4");
if (lpgetfreeresources == null)
{
messagebox(null, "can't load _mygetfreesystemresources32@4 function!", "error",
mb_ok|mb_iconstop);
freelibrary(hrsrc);
return false;
}for (int i = 0; i < 3; i++)
{
lfree[i] = lpgetfreeresources(i); // 获得剩余资源
… // 其他操作
}