How do you get System/User/GDI resource values?

I've used the GlobalMemoryStatus function to retrieve the MemoryStatus structure, and it gives the dwMemoryLoad percentage (subtracted from 100 gives the resource available)..but it differs from the other resource monitors I have (Windows and Norton..which always agree).

And besides, this method doesn't give seperate values for User or GDI resources.
Posted on 2002-04-16 06:42:04 by gscundiff
Found this in one of my helper apps (kinda like an archiver).

Private Declare Function GetFreeResources Lib "RSRC32" Alias "_MyGetFreeSystemResources32@4" (ByVal lWhat As Long) As Long
Private Sub Form_Load()
Me.AutoRedraw = True
'get resource information
Me.Print "Free System Resources: " + CStr(GetFreeResources(GFSR_SYSTEMRESOURCES)) + "%"
Me.Print "Free GDI Resources: " + CStr(GetFreeResources(GFSR_GDIRESOURCES)) + "%"
Me.Print "Free User Resources: " + CStr(GetFreeResources(GFSR_USERRESOURCES)) + "%"
End Sub


Posted on 2002-04-16 12:02:22 by Graebel
Hi Graebel,

I've seen a similar scheme on a couple of listings in Delphi and VB while Googling. I guess I just don't understand how to go about implementing/translating any of it into Masm.

I was hoping to find an API or some structure that would give me something to work with but haven't run across any yet.
Posted on 2002-04-16 16:52:32 by gscundiff
OK (after a WILD night at work..and thinking a little clearer)..

Thanks to Graebel, I looked into RSRC32.DLL and see the function _MyGetFreeSystemResources32@4. I'll play with that for awhile now !
Posted on 2002-04-17 09:13:48 by gscundiff
Can anyone offer some clues on how to access the function _MyGetFreeSystemResources32@4 in RSRC32.DLL ?
Posted on 2002-04-18 13:59:10 by gscundiff
Yeah, I would like to see that as well hehe. I was always a little in the dark on how Masm32 was including system DLLs. In other languages I can explicitly see the calls to some load function. Here its just a mystery so far.

Wish I could give you the answer gscundiff (beyond what API they used)... :rolleyes:
Posted on 2002-04-18 17:12:57 by Graebel
Hi Graebel,

Guess I opened up a can o worms...after looking at this:;EN-US;q190217

there's got to be a better way than thunking down to 16bit code from 32...
Posted on 2002-04-19 07:51:24 by gscundiff
Posted on 2002-04-19 19:49:15 by grv575
You're going to have to find another way if you want it to work on XP.
Posted on 2002-04-20 05:33:52 by iblis
Thanks grv575,

That gives us something to play with !!
Posted on 2002-04-21 07:49:39 by gscundiff