|
Hola aqui tienes para averiguar el numero de serie del disco duro, ya te queda menos jejeje.Salu2.CRIS.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
SpeedButton1: TSpeedButton;
Edit1: TEdit;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
function GetVolumeID(DriveChar: Char): String;
var
MaxFileNameLength, VolFlags, SerNum: DWord;
begin
if GetVolumeInformation(PChar(DriveChar + ':\'), nil, 0,
@SerNum, MaxFileNameLength, VolFlags, nil, 0)
then
begin
Result := IntToHex(SerNum,8);
Insert('-', Result, 5);
end
else
Result := '';
end;
{$R *.dfm}
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Label1.Caption:=GetVolumeId('c');
end;
end.
y de esta forma te dara los datos del disco duro en decimal:
------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
SpeedButton1: TSpeedButton;
Edit1: TEdit;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
function GetVolumeID(DriveChar: Char): String;
var
MaxFileNameLength, VolFlags, SerNum: DWord;
begin
if GetVolumeInformation(PChar(DriveChar + ':/'), nil, 0,
@SerNum, MaxFileNameLength, VolFlags, nil, 0)
then
begin
Result := IntToStr(SerNum);
end
else
Result := '';
end;
{$R *.dfm}
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Label1.Caption:=GetVolumeId('c');
end;
end.
|