2
:
: , , C++Builder.
.
1. C++Builder TListBox, TButton( Standard ), TImage( Additional ). :
2. Unit1.cpp
#include <jpeg.hpp> - jpeg( uses jpeg)
#include <filectrl.hpp> - FindFirst FindNext,
3. , , . SelectDirectory,
, Button1 - OnClick :
/* , , ListBox, , , */
if (SelectDirectory(" ", "",Path))
{
Path = Path + "\\";
Form1->Caption = " - " + Path;
FillListBox();
}
4. ListBox FillListBox() Path, . Unit1.h.
class TForm1: public TForm
{
__published: // IDE-managed Components
TListBox *ListBox1;
TImage *Image1;
TButton *Button1;
void __fastcall ListBox1Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
__fastcall int FillListBox();
AnsiString Path;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
Unit1.cpp , .. TForm1 FillListBox(), , exe-.
//
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
// .. Path " ",
//
// , .. , exe-
this->FillListBox();
}
FillListBox():
// jpg-
__fastcall TForm1::FillListBox(){
TSearchRec SearchRec; // , VCL
int r;
r = FindFirst(Path + "*.jpg",faAnyFile,SearchRec);