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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Cannot delete files after FillFromDirectory

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Tod Posted - Feb 23 2012 : 12:15:40
I am using the FillFromDirectory function to populate thumbnails. I then have a Popup menu with a delete option. I call DeleteSelectedImages, and all the selected thumbs are removed. This works good. However, the actual files are still locked and cannot be deleted. Is there a work around for this or has it been fixed in 4.1?

I am using 4.01 (requested an update for 4.1)

Thanks
5   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Feb 24 2012 : 09:58:48
This because DeleteImage() empties current selection before actually delete the specified image. It returns 1 because only one image remains selected after DeleteImage(). This is the same behavior of old versions (3.x), so you should have the same result with 4.0.1.
To remove selected images you should call DeleteSelectedImages().
Tod Posted - Feb 23 2012 : 14:56:48
Since upgrading to 4.1, the problem has vanished using DeleteSelectedImages.

One thing of note you may want to investigate

If using a loop similar to what I have above in 4.1, the function
imgView.MultiSelectedImagesCount; returns improper values after deleting 1 image. i.e. Enter loop with 3 selected images. Call DeleteImage, then look at the value returned by imgView.MultiSelectedImagesCount; It should be 2, but instead returns 1. In version 4.01, it returned a proper value.



fab Posted - Feb 23 2012 : 13:37:54
TImageEnMView doesn't leave open (hence locked) source file. It caches image buffers on disk, but leave original file closed.
Actually I cannot explain because ReleaseBitmap help you: it should not help, because it just releases a bitmap retrieved using GetBitmap or GetTIEBitmap.
However I tested FillFromDirectory, followed by a DeleteSelectedImages and DeleteFile, without problems.
Tod Posted - Feb 23 2012 : 12:54:24
yea, they are all bitmaps.

I believe I have found a solution.

j:=imgView.MultiSelectedImagesCount;
i:=0;
sl:=TStringList.Create;
while (i<j) do begin
    s:=imgView.ImageFileName[imgView.MultiSelectedImages[0]];
    sl.Add(s);
    inc(i);
    imgView.ReleaseBitmap(imgView.MultiSelectedImages[0]);
    imgView.DeleteImage(imgView.MultiSelectedImages[0]);
    j:=imgView.MultiSelectedImagesCount;
end;
for i:=0 to sl.Count-1 do DeleteFile(sl[i]);
sl.Free;


The imgView.ReleaseBitmap(imgView.MultiSelectedImages[0]); line is the key.
xequte Posted - Feb 23 2012 : 12:22:50
Hi

Are these just image files? What version of windows are you using?

Can you confirm that ImageEn is locking them by:

1. Deleting some random files from a folder
2. Use FillFromDirectory on that folder
3. Delete some more random files from that folder
4. Close the test app
5. Delete some more random files from that folder


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com