Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring GDI, User and System resources

Status
Not open for further replies.

Francis

Programmer
Jan 26, 1999
124
0
0
GB
I need to Monitor GDI, User and System resources to allow my app to warn and go to a safe state before resources run out.<br>
Does anyone know how to do this? I have used 16 bit API calls before - GetFreeSystemResources - but I<br>
cannot seem to find the 32 bit equivalents<br>
Thanks for any help
 
In the 16-bit world of Windows, the global memory and user information was obtained using the GetFreeSpace and GetFreeSystemResources APIs. Under Win32, these were dropped and replaced with the GlobalMemoryStatus API.
 
Yes, I know, I used GetFreeSystemResources in Win16, but GlobalMemoryStatus returns a MEMORYSTATUS<br>
Type MEMORYSTATUS<br>
dwLength As Long<br>
dwMemoryLoad As Long<br>
dwTotalPhys As Long<br>
dwAvailPhys As Long<br>
dwTotalPageFile As Long<br>
dwAvailPageFile As Long<br>
dwTotalVirtual As Long<br>
dwAvailVirtual As Long<br>
End Type<br>
<br>
Where are GDI, User and System resources?<br>
I use the Win98 resource meter, which shows the info I want, but I need to get it programmatically and I cannot find it in a MEMORYSTATUS. Any idea is welcome please.<br>
Thanks<br>
Francis<br>

 
Francis,<br>
<br>
I haven't has an app run out of resources like that in a while now (not since I left the heady days of programming for MS WFW behind me in fact), must be quite an app for you to be having problems.<br>
<br>
What does it do?<br>
<br>
Mike<br>
<p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
In 16-bit versions of Visual Basic, you can determine free system resources by calling the GetFreeSystemResources Windows API function. For 32-bit versions of Visual Basic, there is no Win32 API function that provides that information. To determine free system resources in a 32-bit Visual Basic application, you must call a 16-bit application. This article includes instructions to: <br>
<br>
<br>
Create a 16-bit Visual Basic 4.0 OLE server that determines free system resources and provides that information to OLE clients. <br>
<br>
<br>
Call the 16-bit OLE server from a 32-bit version of Visual Basic and get free system resources from it. <br>
<br>
look at :<br>
<br>
<br>
<br>
<br>
<br>
 
Try the following:<br>
<br>
Const SR = 0<br>
Const GDI = 1<br>
Const USR = 2<br>
<br>
Declare Function pBGetFreeSystemResources Lib &quot;rsrc32.dll&quot; Alias &quot;_MyGetFreeSystemResources32@4&quot; (ByVal iResType As Long) As Long<br>
<br>
This returns the free System, User and GDI resources depenging on which of the constants is passed to it.<br>
<br>
-Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top