PRB: "Entry point GetFreeSystemResources not found" Error

Last reviewed: February 20, 1996
Article ID: Q146424
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0 and 3.0b

SYMPTOMS

A method for obtaining Windows system resources is described in the following Microsoft Knowledge Base article:

   ARTICLE-ID: Q111508
   TITLE     : How to Check Available Windows System Resources

If this method is used under Windows 95 or Windows NT, the following error occurs when the function is registered with RegFn():

   Entry point GetFreeSystemResources not found

CAUSE

The GetFreeSystemResources function is not contained in the API libraries searched by default.

RESOLUTION

In the RegFn function, you need to explicitly reference User.exe where this API function is contained.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

This is a modification of the code example in article Q111508. Enter the following commands into a program file, and run the file:

* Beginning of Check System Resources program

   LOCAL nGetSysRes, nRetVal

   #DEFINE sysreso 0
   #DEFINE gdireso 1
   #DEFINE userreso 2

   * Load the FOXTOOLS.FLL library
   SET LIBRARY TO HOME() + "FOXTOOLS.FLL" ADDITIVE

   * Call RegFN() to register the GetFreeSystemResources() function
   nGetSysRes = RegFn("GetFreeSystemResources", "I","I")

   * If RegFn() returned a value that is greater than -1, it can be
   * assumed that the function was successfully registered.
   IF nGetSysRes > -1
      nRetVal = CallFn(nGetSysRes, sysreso)
      WAIT WINDOW "Free System Resources:"+STR(nRetVal,3,0)+"%" TIMEOUT 1
      nRetVal = CallFn(nGetSysRes, gdireso)
      WAIT WINDOW "Free GDI Resources:"+STR(nRetVal,3,0)+"%"  TIMEOUT 1
      nRetVal = CallFn(nGetSysRes, userreso)
      WAIT WINDOW "Free User Resources are:"+STR(nRetVal,3,0)+"%" TIMEOUT 1
   ENDIF

   * Unload FOXTOOLS.FLL from memory

   RELEASE LIBRARY HOME()+ "FOXTOOLS.FLL"

* End of Check System Resources program

Resolution

If the following line in the example:

   nGetSysRes = RegFn("GetFreeSystemResources", "I","I")

is modified to read as follows:

    nGetSysRes = RegFn("GetFreeSystemResources", "I","I","USER.EXE")

the example will successfully return system resources in Windows 3.1x, Windows 95, and Windows NT.

NOTE: The values returned vary in significance depending on the operating system. Under Windows NT, resources are dynamically allocated, and GetFreeSystemResources will always return 90% for GDI, USER, and SYSTEM. Under Windows 95, these are allocated differently. For a discussion of GDI and USER heaps under Windows 95, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q125699
   TITLE     : GDI Objects and Windows 95 Heaps

   ARTICLE-ID: Q125676
   TITLE     : New User Heap Limits Under Windows 95


Additional reference words: 3.00 3.00b VFoxWin
KBCategory: kbprg kbprb
KBSubcategory: FxprgFoxtools


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 20, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.