Author: Jonas Bilinkevicius How to get the free system resources Answer: 1 unit Sysresources; 2 3 interface 4 5 uses 6 Windows, Sysutils; 7 8 const 9 GFSR_SYSTEMRESOURCES = 0; 10 GFSR_GDIRESOURCES = 1; 11 GFSR_USERRESOURCES = 2; 12 13 function GetSystemResources(typ: Word): Integer; 14 15 implementation 16 17 var 18 hDll: HMODULE; 19 pProc: function(typ: word): Integer; stdcall; 20 21 function GetSystemResources(typ: word): Integer; 22 begin 23 result := pProc(typ); 24 end; 25 26 function InternalGetSystemresources(typ: Word): Integer; stdcall; 27 begin 28 result := -1; 29 end; 30 31 initialization 32 pProc := InternalGetSystemresources; 33 if Win32Platform <> VER_PLATFORM_WIN32_NT then 34 begin 35 hdll := LoadLibrary('rsrc32.dll'); 36 if hdll <> 0 then 37 begin 38 @pProc := getProcAddress(hdll, '_MyGetFreeSystemResources32@4'); 39 if @pProc = nil then 40 pProc := InternalGetSystemresources; 41 end; 42 end; 43 finalization 44 if hDLL <> 0 then 45 FreeLibrary(hdll); 46 end.