[QUESTION] TForm(fStayOnTop) and TPicture weird behavior
Posted on 2003-12-05
i have a strange problem (i've a workaround but...) involving in appearance order : Delphi7 Enterprise, a TForm and a Timage component.
i set my FormStyle as fsStayOnTop. i put a TImage component on my form and add the JPEG unit in the uses clause.
When i load an image for the first time (with the form shown on screen), everything goes fine, my jpeg picture is loaded and displayed with no error.
Then, when i load another picture, i got a violent 'Access Violation' with the TPicture.loadfromfile at this place :
procedure TPicture.LoadFromFile(const Filename: string);
Ext := ExtractFileExt(Filename);
Delete(Ext, 1, 1);
GraphicClass := FileFormats.FindExt(Ext);
if GraphicClass = nil then
raise EInvalidGraphic.CreateFmt(SUnknownExtension, [Ext]);
NewGraphic := GraphicClass.Create;
NewGraphic.OnProgress := Progress;
NewGraphic.LoadFromFile(Filename); <=== AccessViolation Here !
FGraphic := NewGraphic;
FGraphic.OnChange := Changed;
after several hours of debugging, a lot of cup of coffee, i've found a workaround setting the form as normal and using the SetForegroundWindow function...
But it's not very satisfying...
So if anyone has an explanation... just listening...
thanks in advance,
ps: setting 125 points for it, as it's not, for the moment very important, but i think it might not be very easy to find the solution...