Re: Access violation in TJPEGImage on W2K and XP
- From: "jodleren" <sonnich@xxxxxx>
- Date: 16 Sep 2005 01:20:25 -0700
The dormat and stuff are new, the original code was:
if (LowerCase(ExtractFileExt(sFilename)) = '.jpg') or
(LowerCase(ExtractFileExt(sFilename)) = '.jpeg') then
begin
{ delete old bitmapfile }
DeleteFile(PChar(WindowsDir + sWinImgFile));
{ converts the image }
try
BitmapImage := TBitmap.Create;
JPEGImage := TJPEGImage.Create;
if FileExists(sFilename) then
JPEGImage.LoadFromFile(sFilename)
else
JPEGImage.LoadFromFile(WindowsDir + sFilename);
BitmapImage.Assign(JPEGImage);
BitmapImage.SaveToFile(WindowsDir + sWinImgFile);
BitmapImage.Free;
JPEGImage.Free;
except
BitmapImage.Free;
JPEGImage.Free;
end;
end;
I agree that the finally should be better, but that is really not the
problem, nor Dormat or those.
I have played with this for some time, and by removing the Assign it
does no longer give the access violation.
The code is so simple, yes, it should work.
But it does not explain the access violation when closing the app.
That is my main point.
Best regards
Sonnich
.
- Follow-Ups:
- Re: Access violation in TJPEGImage on W2K and XP
- From: Nicholas Sherlock
- Re: Access violation in TJPEGImage on W2K and XP
- From: J French
- Re: Access violation in TJPEGImage on W2K and XP
- References:
- Access violation in TJPEGImage on W2K and XP
- From: jodleren
- Re: Access violation in TJPEGImage on W2K and XP
- From: Nicholas Sherlock
- Access violation in TJPEGImage on W2K and XP
- Prev by Date: Re: "Access denied" on file copy
- Next by Date: Re: Access violation in TJPEGImage on W2K and XP
- Previous by thread: Re: Access violation in TJPEGImage on W2K and XP
- Next by thread: Re: Access violation in TJPEGImage on W2K and XP
- Index(es):