Link to home
Start Free TrialLog in
Avatar of totok
totok

asked on

How I can get system resources status?

Hi,

How I can get system resources status (GDI,System, User) in Windows 9x ?

Is it possible to get system resources status in Windows 2000?

Thank you for your help.
Avatar of CrazyOne
CrazyOne
Flag of United States of America image

No matter what Win 2000 always returns 90% because Win 2000 and NT and XP have pretty much virtually eliminated System Resources.

For Win 9x take a look at this KB from MS. Although it was written for VB it still has some very useful info. One of which there is not any direct 32bit call to the system that can be made to get this info from a 32bit application.

http://support.microsoft.com/support/kb/articles/Q190/2/17.ASP 



The Crazy One
If you have a 16bit version of Delphi then you could use the GetFreeSystemResources 16bit API to get the info.

Also you take a look at this link.
http://support.microsoft.com/support/kb/articles/Q155/7/63.ASP
GetCommandLine() retrieves the command line used to launch your application.

GetComputerName() retrieves the network computer name.

GetDiskFreeSpace()retrieves information on free disk space.

GetDriveType() retrieves a specified drive type, such as fixed or removable.

GetLocalInfo() retrieves information on the specified locale.

GetLocalTime() retrieves the local time.

GetLogicalDrives() retrieves the drives available to the machine.

GetLogicalDriveStrings() Retrieves the names of the drives available to the machine.

GetStartupInfo() retrieves the startup information for the applications main window.

GetSystemDefaultLangID() retrieves the system default language identifier.

GetSystemDefaultLCID() retrieves the system default locale identifier.

GetSystemDirectory() retrieves the Windows system directory.

GetSystemInfo() retrieves system hardware information.

GetSystemTime() retrieves the current system time.

GetSystemTimeAsFileTime() retrieves the current system time in a file system time format.

GetTimeZoneInformation() retrieves time zone information concerning standard and daylight savings time.

GetUserDefaultLangID() retrieves the user defined default language identifier.

GetUserDefaultCID() retrieves the user defined default local identifier.

GetUSerName()retrieves the logged on network user name.

GetVersionEx() retrieves the windows version.

GetVolumeInformation() retrieves information on the specified volume.


Hope this helps you narrow down what your search.


GEM

ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manuel Lopez-Michelone
Here is a component I found some time ago, Hope this helps...

best regards,
Manuel Lopez (lopem)

{*************************************************************}
{            ResMeter Component for Delphi 32                 }
{ Version:   1.0                                              }
{ Author:    Aleksey Kuznetsov                                }
{ E-Mail:    info@utilmind.com                                }
{ Home Page: http://www.utilmind.com                          }
{ Created:   June, 30, 1999                                   }
{ Modified:  June, 30, 1999                                   }
{ Legal:     Copyright (c) 1999, UtilMind Solutions           }
{*************************************************************}
{ PROPERTIES:                                                 }
{   ResSystem: Byte - Determines the system resources in %    }
{   ResGDI: Byte - Determines the GDI resources in percents   }
{   ResUSER: Byte - Determines the USER resources in percents }
{*************************************************************}
{                     IMPORTANT NOTE:                         }
{ This software is provided 'as-is', without any express or   }
{ implied warranty. In no event will the author be held       }
{ liable for any damages arising from the use of this         }
{ software.                                                   }
{ Permission is granted to anyone to use this software for    }
{ any purpose, including commercial applications, and to      }
{ alter it and redistribute it freely, subject to the         }
{ following restrictions:                                     }
{ 1. The origin of this software must not be misrepresented,  }
{    you must not claim that you wrote the original software. }
{    If you use this software in a product, an acknowledgment }
{    in the product documentation would be appreciated but is }
{    not required.                                            }
{ 2. Altered source versions must be plainly marked as such,  }
{    and must not be misrepresented as being the original     }
{    software.                                                }
{ 3. This notice may not be removed or altered from any       }
{    source distribution.                                     }
{*************************************************************}

unit ResMeter;

interface

uses
  SysUtils, Windows, Classes, Controls, Forms;

type
  TResMeter = class(TComponent)
  private
    function GetSystemRes: Byte;
    function GetGDIRes: Byte;
    function GetUSERRes: Byte;
    procedure SetNone(Value: Byte);
  protected
  public
  published
    property ResSystem: Byte read GetSystemRes write SetNone;
    property ResGDI: Byte read GetGDIRes write SetNone;
    property ResUser: Byte read GetUserRes write SetNone;
  end;

procedure Register;

implementation

const
  cSystemRes = 0;
  cGDIRes = 1;
  cUSERRes = 2;

var
  hInst16: THandle;
  SR: Pointer;

function LoadLibrary16(LibraryName: PChar): THandle; stdcall; external kernel32 index 35;
procedure FreeLibrary16(HInstance: THandle); stdcall; external kernel32 index 36;
function GetProcAddress16(Hinstance: THandle; ProcName: PChar): Pointer; stdcall; external kernel32 index 37;
procedure QT_Thunk; cdecl; external kernel32 name 'QT_Thunk';

function GetFreeSysRes(SysRes: Word): Word;
var
  Thunks: Array[0..$20] of Word;
begin
  Thunks[0] := hInst16;
  hInst16 := LoadLibrary16('user.exe');
  if hInst16 < 32 then
    raise Exception.Create('Can''t load USER.EXE!');
  FreeLibrary16(hInst16);
  SR := GetProcAddress16(hInst16, 'GetFreeSystemResources');
  if SR = nil then
    raise Exception.Create('Can''t get address of GetFreeSystemResources!');
  asm
    push SysRes       // push arguments
    mov edx, SR       // load 16-bit procedure pointer
    call QT_Thunk     // call thunk
    mov Result, ax    // save the result
  end;
end;

function TResMeter.GetSystemRes: Byte;
begin
  Result := GetFreeSysRes(cSystemRes);
end;

function TResMeter.GetGDIRes: Byte;
begin
  Result := GetFreeSysRes(cGDIRes);
end;

function TResMeter.GetUSERRes: Byte;
begin
  Result := GetFreeSysRes(cUSERRes);
end;

procedure TResMeter.SetNone(Value: Byte);
begin
end;

procedure Register;
begin
  RegisterComponents('UtilMind', [TResMeter]);
end;

end.
Avatar of Gwena
Gwena

Listening :-)
Avatar of totok

ASKER

Thank you for the answer. It works great!