Informações sobre o computador

Delphi

11/03/2005

Pessoal,

Alguem ai sabe como eu faço para pegar algumas informações sobre o computador?

Tipo:
Modelo e Espaço do HD, Total de Memoria, Placa de Video e Memoria, Som, Teclado, Mouse, Plade de Rede ?

Se algum puder me ajuda !


Obrigado !


Gilbertoscruz

Gilbertoscruz

Curtidas 0

Respostas

Rômulo Barros

Rômulo Barros

11/03/2005

[color=red:7511a12649][u:7511a12649][b:7511a12649]Para capturar informações sobre memória:[/b:7511a12649][/u:7511a12649][/color:7511a12649] [url=http://forum.clubedelphi.net/viewtopic.php?t=59449&highlight=]TOTAL DE MEMÓRIA CONSUMIDA[/url]

[u:7511a12649][color=red:7511a12649][b:7511a12649]Espaço no HD: [/b:7511a12649][/color:7511a12649][/u:7511a12649]

Inclua na seção uses: Windows                                                   
Coloque um memo (TMemo) no form;
Coloque um botão e altere seu OnClick como abaixo:
procedure TForm1.Button1Click(Sender: TObject);
var
SetoresPorAgrup, BytesPorSetor, AgrupLivres,
TotalAgrup: DWord;
begin
Memo1.Clear;
if GetDiskFreeSpace(´C:\´, SetoresPorAgrup,
BytesPorSetor, AgrupLivres, TotalAgrup) then
with Memo1.Lines do begin
Add(´Setores por agrupamento: ´ + IntToStr(SetoresPorAgrup));
Add(´Bytes por setor: ´ + IntToStr(BytesPorSetor));
Add(´Agrupamentos livres: ´ + IntToStr(AgrupLivres));
Add(´Total de agrupamentos: ´ + IntToStr(TotalAgrup));
Add(´----- Resumo -----´);
Add(´Total de bytes: ´ +
IntToStr(TotalAgrup * SetoresPorAgrup * BytesPorSetor));
Add(´Bytes livres: ´ +
IntToStr(AgrupLivres * SetoresPorAgrup * BytesPorSetor));
end;
end;
O exemplo acima retorna as medidas em Bytes, Setores e Agrupamentos. Se preferir
algo mais simples, use funções do Delphi. Veja:
Memo1.Lines.Add(´Total de bytes: ´ + IntToStr(DiskSize(3)));
Memo1.Lines.Add(´Bytes livres: ´ + IntToStr(DiskFree(3)));
Onde o parâmetro (3) é o número da unidade, sendo 1=A, 2=B, 3=C, ...
Observações: Para usar as funções DiskSize e DiskFree coloque SysUtils em uses.



[color=red:7511a12649][u:7511a12649][b:7511a12649]Porcentagem de espaço livre disponível no HD:[/b:7511a12649][/u:7511a12649][/color:7511a12649]

function Percentdisk(unidade: byte): Integer;
var
A,B, Percentual : longint;
begin if DiskFree(Unidade)<> -1 then begin
   A := DiskFree(Unidade) div 1024;
   B := DiskSize(Unidade) div 1024;
Percentual:=(A*100) div B;
   result := Percentual;
end else begin
   result := -1; end; end;


[u:7511a12649][color=red:7511a12649][b:7511a12649]Verficar se existe placa de som no PC:[/b:7511a12649][/color:7511a12649][/u:7511a12649]

// Verifica  se existe uma placa de som no PC.
Procedure TestaPlaca(Value:integer);
begin
som := ´´;
if WaveOutGetNumDevs > 0 then begin
result := True
end else begin
Result := False;
end; end;


[color=red:7511a12649][u:7511a12649][b:7511a12649]Informações Sobre o PC na Rede:[/b:7511a12649][/u:7511a12649][/color:7511a12649]

// Requer a bliblioteca  Registry  declarada.                      
function GetNetStation(Tipo:Integer) : string;
var
Reg : TRegistry;
begin
Reg := TRegistry.create;
Result := ´(n/a)´;
with Reg do try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(´SystemCurrentControlSetServicesVxDVNETSUP´, false) then
begin case Tipo of
1: Result := ReadString(´ComputerName´);
2: Result := ReadString(´Workgroup´);
3: Result := ReadString(´Comment´);
end;end;
Finally
CloseKey;
free;end;end;


[color=red:7511a12649][u:7511a12649][b:7511a12649]Verificar Quantos botões tem no MOUSE:[/b:7511a12649][/u:7511a12649][/color:7511a12649]

function MouseGetButtons: byte;
begin
Result := GetSystemMetrics(SM_CMOUSEBUTTONS);
end;



GOSTEI 0
POSTAR