Article View: borland.public.cppbuilder.nativeapi
Article #10323GetVolumeInformation Problem
From: LarryJ
Date: Sat, 24 Apr 2004 21:42
Date: Sat, 24 Apr 2004 21:42
27 lines
1945 bytes
1945 bytes
I am using the API GetVolumeInformation to see a customers hard drive serial
number as seen below. I place the volume serial number into an unsigned long
which has a maximum of 10 digits. I convert the unsigned long into an
AnsiString using IntToStr() and then show the number in an Edit box. The
problem I am having is that the hard drive serial number sometimes show up
in the edit box as a negative number which should not be possible using an
unsigned long. In addition, the Edit box some times shows a negative 10
digit number such as "-1069816821" which the unsigned long theoretically
can not even hold. Am I using the GetVolumeInformation wrong? Why are some
people getting these bad results? I use hard drive serial number for
registring my software so I need it to work.
int rc=0;
AnsiString CompNum;
char volname[VOLNAMESIZE];
unsigned long volser=0;
rc = GetVolumeInformation("C:\\", (char *)&volname, VOLNAMESIZE, &volser,
NULL, NULL, NULL, 0);
CompNum = IntToStr(volser);
Form2->Edit1->Text = CompNum;
Thanks
Larry
Technical Details
Message-ID:
<408ae02c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c24bbdaaf95607e1,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-24 15:00:12 PST Reply-To: "LarryJ" <LarryJ33@ev1.net> From: "LarryJ" <LarryJ33@ev1.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: GetVolumeInformation Problem Date: Sat, 24 Apr 2004 16:42:31 -0500 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 216.40.235.21 Message-ID: <408ae02c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082843180 216.40.235.21 (24 Apr 2004 14:46:20 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail