Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hard disk information

Posted on 2002-03-08
1
Medium Priority
?
421 Views
Last Modified: 2010-04-05
Hi,

Does anybody know how to get disk information (hard drive) without having to add some third party component? Does Delphi itself provide such feature (something like "GetDiskInfo")? I have to get HD number...

Thanks in advance
0
Comment
Question by:binho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
tongalite earned 150 total points
ID: 6851267


Hi this will do what you want.
Have fun
T.

unit GetSer;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
function GetDiskSerialNumber(Disk: char): string;
var
 VolumeSerialNumber,
 MaximumComponentLength,
 FileSystemFlags: DWORD;
 SerialNumber: string;
begin

 GetVolumeInformation(PChar(Disk + ':\'),
                      nil,
                      0,
                      @VolumeSerialNumber,
                      MaximumComponentLength,
                      FileSystemFlags,
                      nil,
                      0);
 SerialNumber := Format('%.4X-%.4X', [HiWord(VolumeSerialNumber), LoWord(VolumeSerialNumber)]);

 Result := SerialNumber;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.caption:=(GetDiskSerialNumber('C'));
 
end;

end.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question