注意:是windows系统资源,原来windows95/98下面有系统资源(包括内存,GDI,句柄等)的概念,用GetFreeSystemResources函数(User里面)获取但是到了2k下,只有内存、CPU占用等概念了,也找不到GetFreeSystemResources这样的函数。我想请问应该怎么做,取到剩余“系统资源”(要考虑9x和2k的情况)工作需要,急求!!!

解决方案 »

  1.   

    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
      

  2.   

    2000并没有每个程序的句柄数量和GDI数量的限制啊,9x系列系统有限制的。所以2000下你只需要管理CPU和内存就可以了,但是如果一个烂程序占用了GDI资源不释放也是很痛苦的一件事情,那样会占用过多的CPU时间和大量的内存空间。
      

  3.   

    1楼的取出来的是系统信息(CPU信息等),我要的是系统资源!!!2楼的等于没说,我要的就是98的...
      

  4.   

    获得剩余系统、用户、gdi资源的方法(windows 98) 
    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); // 获得剩余资源
    … // 其他操作
    }
      

  5.   

    上面的这个过程没有我已经自己搞定了,动态调用GetFreeSystemResources(win98的user下),检查是win98才调用。因为这个函数是个16位的,搞得有些麻烦,又调用一个16位的调入过程QtThunk才行。居然还要写点汇编这次弄惨了,搞了一天