Page 1 of 1

PicShow 4.10 AV

PostPosted: March 30th, 2009, 1:47 pm
by mhieta
Hi,

When executed PicShow quickly several times (sometimes more than 10 times) to show loaded image. I'm getting AV in TCustomPicShow.SetProgress line: if HandleAllocated then.




- Marko

Re: PicShow 4.10 AV

PostPosted: March 30th, 2009, 9:57 pm
by Kambiz
Sorry, but neither the screenshot nor the description are helpful.

Could you please attach a code to regenerate the error? And, please mention which version of Delphi is in use.

Re: PicShow 4.10 AV

PostPosted: March 31st, 2009, 4:43 pm
by mhieta
Hi,

Okay here is the code what I use for showing next image:
Code: Select all
procedure TSlideShowForm.ShowNextImage;
var
  t: String;
begin
  IERegisterFormats;
  Timer.Enabled := False;
  // if there is not any image in the list exit
  if Pictures.Count = 0 then Exit;
  // if PicShow is playing, stops it
  if PicShow.Busy then
    PicShow.Stop;
  // Sets the animation style according to user sellection
  if (CustomStyle.Checked) and not (Index=-1) then
  begin
    t:=Pictures[Index];
    if ContainsText(t,'|') then
    begin
      if SetTransitionMode.Checked = True then
      begin
        Style.Value:=StrToInt(Split(t,'|',3));
        Step.Value:=StrToInt(Split(t,'|',4));
        Delay.Value:=StrToInt(Split(t,'|',5));
      end;
      ShowPause.Value:=StrToInt(Split(t,'|',6));
      TimeButton.Caption:=Split(t,'|',7);
      ShowPauseChange(nil);
      BackGroundColor.SelectedColor:=StringToColor(Split(t,'|',8));
      BackgroundColorColorChange(nil);
      FrameWidth.Value:=StrToInt(Split(t,'|',9));
      FrameColor.SelectedColor:=StringToColor(Split(t,'|',10));
      FrameColorColorChange(nil);
    end;
  end;
  if RandomStyle.Checked then
    Style.Value := Random(High(TShowStyle))+1
  else if TurnStyle.Checked then
    if Style.Value < High(TShowStyle) then
      Style.Value := Style.Value + 1
    else
      Style.Value := 1;
  // Updates image name status
  ShownImage := LoadedImage;
  if ClearOldImage.Checked then
  begin
    PicShow.Clear;
    PicShow.Update;
  end;
  StatusBar1.Panels.Items[0].Text:= 'Current Image: ' + MinimizeName(ShownImage,StatusBar1.Canvas,StatusBar1.Panels.Items[0].Width);
  CurrentImage1.Caption:='Current Image: ' + ExtractFileName(ShownImage);
  StatusBar1.Update;
  if SetDesktopMode.Checked then ChangeWallpaper;
  if (Panel7.Visible = True) and (AutoMonitorSwitch.Checked = True) then
  begin
    if (AutoMonitorSwitchMonitor1.ItemIndex = 0) and (AutoMonitorSwitchMonitor2.ItemIndex = 1) then
    begin
      if (PicShow.Picture.Height > PicShow.Picture.Width) and (GetMonitorFromWindow(handle) = 1) then GoTo1stMonitorClick(nil);
      if (PicShow.Picture.Width > PicShow.Picture.Height) and (GetMonitorFromWindow(handle) = 0) then GoTo2ndMonitorClick(nil);
    end;
    if (AutoMonitorSwitchMonitor1.ItemIndex = 1) and (AutoMonitorSwitchMonitor2.ItemIndex = 0) then
    begin
      if (PicShow.Picture.Height > PicShow.Picture.Width) and (GetMonitorFromWindow(handle) = 0) then GoTo2ndMonitorClick(nil);
      if (PicShow.Picture.Width > PicShow.Picture.Height) and (GetMonitorFromWindow(handle) = 1) then GoTo1stMonitorClick(nil);
    end;
    Application.ProcessMessages;
  end;
  // Begins the animation
  PicShow.Execute;
  IEUnRegisterFormats;
end;


And Delphi 2007 is in use. Its hard to show some code cause its not happening every time when PicShow is executed.

- Marko

Re: PicShow 4.10 AV

PostPosted: March 31st, 2009, 6:32 pm
by mhieta
Hi,

Just reversed PicShow back to 4.07 version without modifying my own code. Now everything works as it should.

- Marko

Re: PicShow 4.10 AV

PostPosted: April 4th, 2009, 12:47 pm
by Kambiz
I made consequent calls to ShowNextImage (in PicShow Demo) without delay, but no error occurred.

Your code is dependent to other codes, because of that I couldn't check it out.

Regarding your code, it's better to use

Code: Select all
  PicShow.OverDraw := not ClearOldImage.Checked;

instead of

Code: Select all
  if ClearOldImage.Checked then
  begin
    PicShow.Clear;
    PicShow.Update;
  end;

Re: PicShow 4.10 AV

PostPosted: April 4th, 2009, 6:05 pm
by mhieta
Hi,

Yes that code depends on many other codes, sorry. But anyway its very hard to explain this AV. Yes if you do that without any delay you don't hit AV, I noticed that too. But when calling ShowNextImage in the middle of transition several times it will eventually hit to AV. Also sometimes before AV is shown, PicShow shows blank image instead of image.

Thanks for the tip :)

- Marko

Re: PicShow 4.10 AV

PostPosted: April 4th, 2009, 8:26 pm
by Kambiz
I have checked it with delay too, but no exception. Without being able to regenerate the AV, I don't know where should be fixed.

Re: PicShow 4.10 AV

PostPosted: April 4th, 2009, 9:56 pm
by mhieta
Hi,

Okay. If I find some way to show this issue better I will tell :)

- Marko