빌더의 헬프에 있는 예제입니다.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TSearchRec sr;
int iAttributes = 0;
StringGrid1->RowCount = 1;
iAttributes |= faReadOnly * CheckBox1->Checked;
iAttributes |= faHidden * CheckBox2->Checked;
iAttributes |= faSysFile * CheckBox3->Checked;
iAttributes |= faVolumeID * CheckBox4->Checked;
iAttributes |= faDirectory * CheckBox5->Checked;
iAttributes |= faArchive * CheckBox6->Checked;
iAttributes |= faAnyFile * CheckBox7->Checked;
StringGrid1->RowCount = 0;
if (FindFirst(Edit1->Text, iAttributes, sr) == 0)
{
do
{
if ((sr.Attr & iAttributes) == sr.Attr)
{
StringGrid1->RowCount = StringGrid1->RowCount + 1;
StringGrid1->Cells[1][StringGrid1->RowCount-1] = sr.Name;
StringGrid1->Cells[2][StringGrid1->RowCount-1] = IntToStr(sr.Size);
}
} while (FindNext(sr) == 0);
FindClose(sr);
}
}
군휘 님이 쓰신 글 :
:
:
:
:
:
:
:
안녕하세요
:
:
잘 머르는것이 있어서리...ㅡㅡ
:
:
고수님들께 질문 드립니당....^^;
:
:
도스의 "DIR/S"같은 기능을 내려면..??
:
:
findfirst와 findnext를 쓰면 된다는것까지는 알겠는데,
:
:
그 알고리듬짜는게 너무 어렵더라구요...^^;
:
:
:
소스좀 주시거나, 아니면 알고리듬을 주시면 감사하겠습니다.
:
:
P.s. findfirst에서요, attribute에 FA_DIREC을 넣으면 디렉토리만 검색되어야 하는거 아닌가요?
:
:
디렉토리 안에 있는 화일이 다 나오는건 왜
: 그런건지도 좀 알려주세요..^^
:
:
:
감사합니다.
:
:
: