Lenguaje de programación Borland Delphi
Abajo mostramos un listado completo del código fuente para obtener datos del PC: tipo de procesador, número de procesadores, arquitectura, tamaño de página, memoria virtual, dirección de memoria baja y alta, ... Para ello necesitaremos un formulario, un ListBox y un botón:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
SysInfo: TSystemInfo;
begin
GetSystemInfo(SysInfo);
with ListBox1.Items, SysInfo do
begin
Add('ProcessorArchitecture:' + IntToStr(wProcessorArchitecture));
Add(FloatToStr(dwPageSize) + ' Kb page size');
Add(Format('Lowest memory address accessible to applications and DLL - %p',
[lpMinimumApplicationAddress]));
Add(Format('Highest memory address accessible to applications and DLL - %p',
[lpMaximumApplicationAddress]));
Add('OEMID:' + IntToStr(dwOemId));
Add('ActiveProcessorMask:' + IntToStr(dwActiveProcessorMask));
Add(IntToStr(dwNumberOfProcessors) + ' - number of processors');
Add('ProcessorType:' + IntToStr(dwProcessorType));
case wProcessorLevel of
3: Add('Intel 80386 processor level');
4: Add('Intel 80486 processor level');
5: Add('Intel Pentium processor level');
end;
Add(FloatToStr(dwAllocationGranularity / 1024) +
' Kb - granularity with which virtual memory is allocated');
Add('ProcessorRevision:' + IntToStr(wProcessorRevision));
end;
end;
end.
Publicado el: 2003-12-28