Deleting Files In Delphi
This is a Delphi specific problem (Believed to be solved in Version 7 and afterwards). Getting errors when trying to delete an image file, even when the Images collection has already been cleared. See the following code:
Images.ReadFile('C:\TestImage.dcm'); Images.Clear; if not DeleteFile('C:\TestImage.dcm') then ShowMessage('couldn't delete TestImage.dcm'); Using the above code, developers always hitting the red line. This is actually caused by the first line where DicomImages.ReadFile is returning a DicomImage object, which is passed (By Delphi) to a hidden variable.