Article View: borland.public.cppbuilder.nativeapi
Article #5443Re: Local or remote drive ?
From: sam
Date: Mon, 15 Aug 2005 17:48
Date: Mon, 15 Aug 2005 17:48
45 lines
2140 bytes
2140 bytes
> Look at API GetDriveType().
Thank you, I have used API GetDriveType().
Sam
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote in message
news:4300cb1d@newsgroups.borland.com...
>> How to know if a file is on a local drive or remote drive ?
>
> Look at API GetDriveType().
>
> This is in practice how I get the first CD ROM drive
> (probably can be optimized):
>
> AnsiString GetFirstCdRomDrive()
> {
> unsigned long r;
> char Drives[129];
> char* pDrive;
> AnsiString Result = "";
>
> r = GetLogicalDriveStrings( sizeof( Drives ), Drives );
>
> if ( r == 0 )
> return ( Result );
> if ( r > sizeof( Drives ) )
> return( Result );
>
> pDrive = &Drives[0]; // Point to the first drive
>
> while ( *pDrive != NULL )
> {
> if ( GetDriveType( pDrive ) == DRIVE_CDROM )
> return ( UpperCase ( (char)*pDrive ) + ":\\" );
> pDrive += 4; // Point to the next drive
> }
>
> return( "" );
> }
>
>
> --
> Best regards,
> Vladimir Stefanovic
>
Technical Details
Message-ID:
<4300d559@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!atl-c07.usenetserver.com!news.usenetserver.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4300c890@newsgroups.borland.com> <4300cb1d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,69972cb9555f348 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "sam" <s33@hotmail.com> From: "sam" <s33@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4300c890@newsgroups.borland.com> <4300cb1d@newsgroups.borland.com> Subject: Re: Local or remote drive ? Date: Mon, 15 Aug 2005 19:48:13 +0200 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 83.195.5.65 Message-ID: <4300d559@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1124128089 83.195.5.65 (15 Aug 2005 10:48:09 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!atl-c07.usenetserver.com!news.usenetserver.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail