ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Wait for file to exist after SaveToFile?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

993 Posts

Posted - Oct 13 2017 :  07:53:32  Show Profile  Reply
I save a file with:

ThisImageFile := MyPath + 'MyImage.png';
ImageEnView1.IO.SaveToFile(ThisImageFile);
CopyFile(ThisImageFile, TargetFile);


As you can see from this code, CopyFile needs the source file to exist.

So how can I ensure that right after "ImageEnView1.IO.SaveToFile" the file already exists?

Does "ImageEnView1.IO.SaveToFile" return only after the file already exists?

Or is there a mechanism to wait after "ImageEnView1.IO.SaveToFile" until the file exists?

xequte

39141 Posts

Posted - Oct 14 2017 :  04:46:35  Show Profile  Reply
Hi Peter

Please see:

https://www.imageen.com/help/TImageEnIO.SaveToFile.html

By default, SaveToFile is blocking. Also, in case of save error an exception is raised. So in your code above, "ThisImageFile" should always exist.

e.g.

ThisImageFile := MyPath + 'MyImage.png';
try
  ImageEnView1.IO.SaveToFile(ThisImageFile);
  CopyFile(ThisImageFile, TargetFile);
except
  ShowMessage('Could not save ' + ThisImageFile );
end;



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

PeterPanino

993 Posts

Posted - Oct 14 2017 :  06:54:04  Show Profile  Reply
Nigel, thanks for the clarification.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: