Ads 468x60px

Smaller time frame always follow the bigger time frame. It's better wait be patience to enter in position than risk with BIG SL. Having strong trading discipline and taking losses when necessary is a sign of serious trading approach
Subscribe:

Labels

Saturday, August 11, 2012

GLOBALMEMORYSTATUS() TO THE RESCUE


"GetFreeSystemResources()" Win16 API function is no longer supported in Win32 API, but you can use "GlobalMemoryStatus()" to get even more memory related information: 
var
  ms : TMemoryStatus;
begin
  ms.dwLength := SizeOf( ms );
  GlobalMemoryStatus( ms );
  with ms do
  begin
    //
    // now you can use any of
    // the following parameters
    //

    // percent of memory in use
    {dwMemoryLoad}

    // bytes of physical memory
    {dwTotalPhys}

    // free physical memory bytes
    {dwAvailPhys}

    // bytes of paging file
    {dwTotalPageFile}

    // free bytes of paging file
    {dwAvailPageFile}

    // user bytes of address space
    {dwTotalVirtual}

    // free user bytes
    {dwAvailVirtual}
  end;
end;
Listing #1 : Delphi code. Download memstat (0.38 KB).
For example: 
function GetMemoryTotalPhys : DWord;
var
  ms : TMemoryStatus;
begin
  ms.dwLength := SizeOf( ms );
  GlobalMemoryStatus( ms );
  Result := ms.dwTotalPhys;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  MessageDlg(
    'total physical memory: ' +
    IntToStr( GetMemoryTotalPhys )
    , mtInformation, [mbOk], 0 );
end;
Listing #2 : Delphi code. Download memtotal (0.36 KB).


comments