A method of obtaining residual systems, users, and GDI resources (Windows 98)

zhaozj2021-02-11  195

A method of obtaining residual systems, users, and GDI resources (Windows 98)

Windows98 provides a function of obtaining the remaining system, user, and GDI resource, but does not mention in the MSDN - another unapproved function :-).

This function is named _mygetfreesystemResources32 @ 4, stealth in the RSRC32.DLL file. The prototype and usage method of the function is as shown below, note the value of the return value of the function is the value of the remaining resource percentage, for example, if the function returns 70, indicating that the corresponding remaining resources are 70%.

Examples // Rsrc32.dll library; typedef long prototype function parameters used #define GFSR_SYSTEMRESOURCES // 0 # define GFSR_GDIRESOURCES 1 # define GFSR_USERRESOURCES 2 // Function (PASCAL * LPGETFREERESOURCES) (int); LPGETFREERESOURCES lpGetFreeResources // pointer function Handle Hinstance HRSRC; / / Save the array of remaining resources Long Lfree [3]; // Get pointer HRSRC = LoadLibrary ("RSRC32.DLL") ("Rsrc32.dll) {MessageBox (NULL," CAN ' t load rsrc32.dll "," Error! ", MB_OK | MB_ICONSTOP); return FALSE;} lpGetFreeResources = (LPGETFREERESOURCES) GetProcAddress (hRsrc," _MyGetFreeSystemResources32 @ 4 "); if (lpGetFreeResources == NULL) {MessageBox (NULL," Can't load _MygetFreesystemResources32 @ 4 function! "," Error ", MB_ok | MB_ICONSTOP); FreeElibrary (HRSRC); Return False;} for (int i = 0; i <3; i ) {lfree [i] = lpgetfreeresources i); // Get the remaining resource ... // Other operation} The author uses this function to write a small software similar to "System Tools - Resources" in the Windows 98 attachment, you can go to the author's home http: //tulipstudio.yeah .NET downloads the source code and execution programs.

A Wen http://tulipstudio.yeah.net

转载请注明原文地址:https://www.9cbs.com/read-5820.html

New Post(0)