Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


load image loadfromfile

russellmanrussellman Member Posts: 4
When you click the start button. This get the current directoy and send to ret_file(). ret_file() gets the filenames and adds the directoy. show_image() displays the images with a pouse between them.
--> The problem is If we use ShowMessage() it works if not no image is displayed. It does not mater whot is in ShowMessage. ShowMessage("HI"); will work.
-->Got any ideas??
Gary Russell

void __fastcall TForm1::Button1Click(TObject *Sender) {
String dir,sl = "\";

//gets the current directory.
dir = AnsiString(DirectoryListBox1->Directory);
dir = dir + sl;

ret_file(dir, 1000); }

//Retrives filenames, with path, of a given directory.
int ret_file(String dir, int delay) {
int x=1, done = 0;

struct ffblk ffblk; //Is a struct used by findfirst() and findnext().

//findfirst() begins a search of a disk directory for files
// specifed by attributes or wildcards.
done = findfirst("*.jpg",&ffblk,0);

while (done == 0) {
String Str1,Str2 = "HI";

//Converts an area[] to an ansistring.
Str1 = AnsiString(ffblk.ff_name); //stored on the stack.
Str1 = dir + Str1; //add dir to file name.

//findnext() returns 0 file is found.
done = findnext(&ffblk);
//Limmits the number of loops.
if(x >= Max_fnames) { done = 1; }


return 0;
void show_image(String image,int delay) {

if(image == NULL) { image = Form1->FileListBox2->FileName; }
else { Form1->FileListBox2->FileName = image; }

//If we use ShowMessage() it works if not no image is displayed.
// ShowMessage(image);



Sign In or Register to comment.