How to Check Available Windows System ResourcesID: Q111508
|
The code sample below demonstrates how FOXTOOLS.FLL can be used to check the available Windows system resources from within FoxPro for Windows or a FoxPro for Windows application.
NOTE: This code only works under Microsoft Windows versions 3.x (16-bit Windows). Under Windows NT or Windows 95, it causes the following error message:
For more information about how to check available Windows system resources under Windows NT or Windows 95, see the following article in the Microsoft Knowledge Base:Entry point GetFreeSystemResources not found.
Q146424 PRB: "Entry Point GetFreeSystemResources Not Found" ErrorFOXTOOLS.FLL is a FoxPro application programming interface (API) library that allows FoxPro programs to call many Windows dynamic-link library (DLL) functions. The FOXTOOLS.WRI document explains how to use FOXTOOLS.FLL. Both files are located in the GOODIES\FOXTOOLS subdirectory of the main FoxPro for Windows directory.
UINT GetFreeSystemResources(fuSysResource)
UINT fuSysResource /* Type of resource to check */
There are three resource types that can be checked:
* Program to check Windows system resources
* Establish constants
#DEFINE sysreso 0
#DEFINE gdireso 1
#DEFINE userreso 2
* Load the FOXTOOLS.FLL library
SET LIBRARY TO SYS(2004) + "FOXTOOLS.FLL" ADDITIVE
* Call RegFN() to register the GetFreeSystemResources() function
getsysres = 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 getsysres > -1
* CallFn() is used to call the GetFreeSystemResources() function
* with the desired parameter. The constant sysreso is used here
* to return the percentage of free resources. CallFn() could also
* be used with the gdireso or userreso constants defined above to
* return the percentage of free GDI or USER resources.
x = CallFn(getsysres, sysreso)
WAIT WINDOW "Current System Resources are:"+STR(x,3,0)+"%"
ENDIF
* Unload FOXTOOLS.FLL from memory
RELEASE LIBRARY SYS(2004)+ "FOXTOOLS.FLL"
Microsoft FoxPro for Windows FOXTOOLS.WRI
Microsoft Windows Software Development Kit "Programmer's Reference, Volume
2: Functions," version 3.1
Additional query words: VFoxWin FoxWin 2.50 api fll fox tools kbvfp300
Keywords : kbcode FxprgFoxtools
Version : 2.50 2.50a 2.50b 3.00
Platform : WINDOWS
Issue type :
Last Reviewed: August 3, 1999