Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 May : Volume Serial Number of the hard disk

www.cryer.info
Managed Newsgroup Archive

Volume Serial Number of the hard disk

Subject:Volume Serial Number of the hard disk
Posted by:"John Warren" (john.warr..@netti.fi)
Date:Fri, 12 May 2006 15:50:10 +0300

Dear Expert programmers,


If you use "dir" command in dos, you get a volume number for the drive e.g.
the C:\ -drive.


How can I get this volume ID by using Delphi 3?


I have searched  the google.com for an info but to no avail.


The code should work in the following operating systems: Windows 95, 98, ME,
NT, 2000 and XP.


I am just wondering why the following function is not working for me.


function GetSerialNumber : string;
var
    Name : PChar;

HDDid:dword;

begin
if GetVolumeInformation('C:\',nil,0,@SerNo,MaxCompLength,
    FileSystemFlags,nil,0) then
  begin
    HDDid:=IntToHex(SerNo,8);
    Insert('-',HDDid,5);

    Name:=HDDid;
  end


I sincerely thank you very much in advance for any hint. Answer by email if
possible.


Yours sincerely,

John

john.warren@netti.fi

Info

Glossary

File Types

Replies:

www.cryer.info
Managed Newsgroup Archive