Kbase 16061: How to access system resource information in Windows
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
How to access system resource information in Windows
DRAFT COPY - Currently under review and edit.
INTRODUCTION:
=============
Use the following Windows API call to retrieve percentage information
on available Windows resources
UINT GetFreeSystemResources(fuSysResource)
The GetFreeSystemResources function returns the percentage of free
space for system resources.
Parameter Description
--------- -----------
fuSysResource Specifies the type of resource to be checked.
This parameter can one of the following values.
Value Decimal Meaning
GFSR_SYSTEMRESOURCES 0 Returns the percentage of free space for
system resources.
GFSR_GDIRESOURCES 1 Returns the percentage of free space for
GDI resources. GDI resources include
device-context handles, brushes, pens
regions, fonts and bitmaps
GFSR_USERRESOURCES 2 Returns the percentage of free space for
USER resources. These resources include
windows and menu handles.
Returns
The return value specifies the percentage of free space for resources,
if the function is successful.
Comments
Since the return value from this function does not guarantee that an
application will be able to create a new object, applications should
not use this function to determine whether it will be possible to
create an object.
/* Example code to demonstrate the Windows API call
GetFreeSystemResources()
Tested under Progress 8.0A02 and Windows 3.11 & 95
28-8-96 sep@emea.progress.com */
DEFINE BUTTON sysres LABEL "Show System Resources".
DEFINE BUTTON bquit LABEL "Quit".
DEFINE FRAME MainFrame
WITH SIDE-LABELS.
ENABLE sysres bquit WITH FRAME MainFrame
TITLE "System resources Demo".
PROCEDURE GetFreeSystemResources EXTERNAL "user.exe":
DEFINE INPUT PARAMETER uflag AS SHORT.
DEFINE RETURN PARAMETER rtn AS SHORT.
END PROCEDURE.
ON CHOOSE OF sysres IN FRAME MainFrame
DO:
DEFINE VAR rtn1 AS INT.
DEFINE VAR rtn2 AS INT.
DEFINE VAR rtn3 AS INT.
RUN GetFreeSystemResources (INPUT 0, OUTPUT rtn1).
RUN GetFreeSystemResources (INPUT 1, OUTPUT rtn2).
RUN GetFreeSystemResources (INPUT 2, OUTPUT rtn3).
message "Free space of System resources = " +
string(rtn1) + "%" + chr(13) +
"Free space of GDI resources = " +
string(rtn2) + "%" + chr(13) +
"Free space of USER resources = " +
string(rtn3) + "%"
view-as alert-box info.
END.
WAIT-FOR CHOOSE OF bquit IN FRAME MainFrame.
Progress Software Technical Support Note # 16061