Article View: borland.public.cppbuilder.nativeapi
Article #14057Re: SHGetSpecialFolderLocation!
From: Remy Lebeau (TeamB)
Date: Mon, 25 Aug 2003 04:46
Date: Mon, 25 Aug 2003 04:46
107 lines
4087 bytes
4087 bytes
"Safari" <Safari@alloymail.com> wrote in message
news:3F48E683.1000408@alloymail.com...
> if (FindFirst(Path + "*.~*;*.tmp;*.temp;*.wri;*.doc", faAnyFile, Search)
You cannot use multiple masks like that. You can only use a single mask, in
which case you will have to use "*.*" as the mask instead and then test each
file that is found with the individual file extensions one at a time. For
example:
TSearchRec Search;
if( FindFirst(Path + "*.*", faAnyFile, Search) == 0 )
{
do
{
if( (Search.Name != ".") && (Search.Name != "..") )
{
AnsiString ext = ExtractFileExt(Search.Name);
if( ext.SubString(1, 2) == ".~" )
//...
else if ( AnsiSameText(ext, ".tmp") )
//...
else if( AnsiSameText(ext, ".temp") )
//...
else if( AnsiSameText(ext, ".wri") )
//...
else if( AnsiSameText(ext, ".doc") )
// ...
//...
}
}
while( FindNext(Search) == 0 );
FindClose(Search);
}
Or:
const char* arr[] = {".tmp", ".temp", ".wri", ".doc"};
TSearchRec Search;
if( FindFirst(Path + "*.*", faAnyFile, Search) == 0 )
{
do
{
if( (Search.Name != ".") && (Search.Name != "..") )
{
AnsiString ext = ExtractFileExt(Search.Name);
bool bFound = false;
if( ext.SubString(1, 2) == ".~" )
bFound = true;
else
{
for(int x = 0; x < 4; ++x)
{
if ( AnsiSameText(ext, arr[x]) )
{
bFound = true;
break;
}
}
}
if( bFound )
//...
}
}
while( FindNext(Search) == 0 );
FindClose(Search);
}
Or, if you have an Enterprise edition of Builder:
#include <Masks.hpp>
const char* masks[] = {"*.~*", "*.tmp", "*.temp", "*.wri", "*.doc"};
TSearchRec Search;
if( FindFirst(Path + "*.*", faAnyFile, Search) == 0 )
{
do
{
if( (Search.Name != ".") && (Search.Name != "..") )
{
for(int x = 0; x < 5; ++x)
{
if( MatchesMask(Search.Name, masks[x]) )
{
//...
break;
}
}
}
}
while( FindNext(Search) == 0 );
FindClose(Search);
}
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/03
Technical Details
Message-ID:
<3f49a10c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3F48E683.1000408@alloymail.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,7ce38efab0f8f813 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-24 22:41:11 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3F48E683.1000408@alloymail.com> Subject: Re: SHGetSpecialFolderLocation! Date: Sun, 24 Aug 2003 21:46:25 -0700 Lines: 109 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f49a10c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1061789964 207.175.226.26 (24 Aug 2003 22:39:24 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail