Getting free resource under Windows 95

If I could have a penny for all the times this question has been posted in discussion board .. well, finally .. looking at Corel Draw 7 script samples (!) I could figure out how to get the free system resource under Windows 95.
And here is the code for you; take care of this - it works ONLY under Windows 95 (not NT) and you must (I think) have the resource meter installed, since we are using its function, not system ones.
In other words, this way will fail if you don't have the "RSRC32.dll" installed.

#include "stdio.h"
#include "windows.h"

#define GFSR_SYSTEMRESOURCES	0
#define GFSR_GDIRESOURCES		1
#define GFSR_USERRESOURCES		2

typedef LONG (CALLBACK* GETRES)(int);

void main()
{
	HINSTANCE hInst = LoadLibrary("RSRC32.dll");
	if (hInst != NULL)
	{
		GETRES pGetRes = (GETRES) GetProcAddress(hInst, "_MyGetFreeSystemResources32@4");//); 

		if (pGetRes)
		{
			long lSysRes = (*pGetRes)(GFSR_SYSTEMRESOURCES);
			long lGdiRes = (*pGetRes)(GFSR_GDIRESOURCES);
			long lUsrRes = (*pGetRes)(GFSR_USERRESOURCES);
			printf("System resource: %d\n", lSysRes);
			printf("GDI resource: %d\n", lGdiRes);
			printf("User resource: %d\n", lUsrRes);
			return;
		}
		printf("Error getting pointer to _MyGetFreeSystemResources32()\n");
		return;
	}
	printf("Error loading rsrc32.dll. You must run this under Win95 only and with the resource meter installed.\n\n");
}

Last updated: 26 June 1998



Comments

  • DLL

    Posted by Legacy on 09/07/2002 12:00am

    Originally posted by: Dima

    How can I get that file, rsrc32.dll or unmodified state(source code)?
    May you send to me by my email address.
    Thank.

    Reply
  • rsrc32.dll

    Posted by Legacy on 10/30/2001 12:00am

    Originally posted by: Hung

    How can I get that file, rsrc32.dll?
    May you send to me by my email address.
    Thank.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Managing your company's financials is the backbone of your business and is vital to the long-term health and viability of your company. To continue applying the necessary financial rigor to support rapid growth, the accounting department needs the right tools to most efficiently do their job. Read this white paper to understand the 10 essentials of a complete financial management system and how the right solution can help you keep up with the rapidly changing business world.

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds