load image loadfromfile - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

load image loadfromfile

russellmanrussellman Posts: 4Member
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
[email protected]

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; }
x++;

show_image(Str1,delay);

}
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);

Form1->Image1->Picture->LoadFromFile(image);
Sleep(delay);
}

Comments

Sign In or Register to comment.