Article View: borland.public.cppbuilder.nativeapi
Article #10326Re: GetVolumeInformation Problem
From: LarryJ
Date: Sat, 24 Apr 2004 22:28
Date: Sat, 24 Apr 2004 22:28
39 lines
2269 bytes
2269 bytes
If I replace the IntToStr() with the AnsiString() and use the unsigned long
volser inside the AnsiString() function as seen below, will this display the
correct volume serial number in the Edit box?
int rc=0;
AnsiString CompNum;
char volname[VOLNAMESIZE];
unsigned long volser=0;
rc = GetVolumeInformation("C:\\", (char *)&volname, VOLNAMESIZE, &volser,
NULL, NULL, NULL, 0);
CompNum = AnsiString(volser);
Form2->Edit1->Text = CompNum;
Thanks
Larry.
"Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> wrote in message
news:408ae5f7$1@newsgroups.borland.com...
> You are using IntToStr, a function which takes an int, a signed
> number. Automatic conversion between signed and unsigned integral
> types is part of the language specification. If the high bit is set
> you then get a string representing a negative number, which is what
> asked it to do.
>
> There are several ways it could be done.
> AnsiString has a constructor which takes an unsigned long
> AnsiString's has a sprintf function
> Both sprintf and wsprintf will write to a character array that
> can then be assigned to an AnsiString
>
> . Ed
>
> > LarryJ wrote in message
> > news:408ae02c$1@newsgroups.borland.com...
> >
> >>
Technical Details
Message-ID:
<408aea19@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<408ae02c$1@newsgroups.borland.com> <408ae5f7$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c24bbdaaf95607e1 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-24 15:38:49 PST Reply-To: "LarryJ" <LarryJ33@ev1.net> From: "LarryJ" <LarryJ33@ev1.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <408ae02c$1@newsgroups.borland.com> <408ae5f7$1@newsgroups.borland.com> Subject: Re: GetVolumeInformation Problem Date: Sat, 24 Apr 2004 17:28:41 -0500 Lines: 41 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.72 Message-ID: <408aea19@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082845721 216.40.235.72 (24 Apr 2004 15:28:41 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail