Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Andiii  
#1 Posted : Wednesday, March 31, 2004 9:27:00 PM(UTC)
Andiii

Rank: Member

Groups: Member
Joined: 3/31/2004(UTC)
Posts: 2

hello,

I found a bug in your (very good) AVI processor I'm afraid!

If you try and run the following which opens an AVI, outputs a single frame to an image and closes the AVI... it works on the first cycle, but fails on the second. Obviously this is a very simple example, but it highlights the issue!!

I'm being pushed to get this project sorted out this week, so a quick response would be appreciated.

Regards Andy.

Code:
Sub form_load()

Me.Show
DoEvents
Dim TempReader As New AviReader
Debug.Print "1"
TempReader.Open App.Path & "\bum.avi"
Debug.Print TempReader.FramesPerSecond, TempReader.Height
Debug.Print "2"
Set Image1.Picture = TempReader.Frames(0).Picture
Debug.Print "3"
TempReader.Close
Debug.Print "4"
TempReader.Open App.Path & "\bum.avi"
Debug.Print TempReader.FramesPerSecond, TempReader.Height
Debug.Print "5"
Set Image1.Picture = TempReader.Frames(0).Picture 'fails here!!!
Debug.Print "6"
TempReader.Close
Debug.Print "7"
           
End Sub



output in immediate window:
_________________________________________
1
>>2 111
2
3
4
>>2 111
5
_________________________________________

Then error message:

Run time error 8000fff
Method "Picture" of object "IAviFrame" failed

Edited by user Monday, December 24, 2007 6:04:13 PM(UTC)  | Reason: Not specified

Andrew  
#2 Posted : Sunday, April 04, 2004 11:27:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 863

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
It seems there is a bug indeed. However I have found a workaround. I noticed that only Picture property fails, so to draw the frame, you can try to use Draw method. This method draws the frame to given HDC. Image control does not have HDC, but PictureBox does, so you should use it instead of Image. Here is an example of modified code:

Code:
    Me.Show
    DoEvents
    Dim TempReader As New AviReader
    Dim filename As String
    Picture1.AutoRedraw = True
    filename = "D:\[Test Files]\AVIS\drillrle.avi"
    Debug.Print "1"
    TempReader.Open filename
    Debug.Print TempReader.FramesPerSecond, TempReader.Height
    Debug.Print "2"
    TempReader.Frames(0).Draw Picture1.hDC, 0, 0
    Picture1.Refresh
    Debug.Print "3"
    TempReader.Close
    Debug.Print "4"
    TempReader.Open filename
    Debug.Print TempReader.FramesPerSecond, TempReader.Height
    Debug.Print "5"
    TempReader.Frames(0).Draw Picture1.hDC, 0, 0
    Picture1.Refresh


Draw attention, to avoid erasing the image everytime you move some window over the image, you should set PictureBox AutoRedraw property to True and call Refresh to update it.

Please let me know if you got any other questions.

Edited by user Monday, December 24, 2007 6:04:34 PM(UTC)  | Reason: Not specified

Andiii  
#3 Posted : Sunday, April 04, 2004 11:33:00 PM(UTC)
Andiii

Rank: Member

Groups: Member
Joined: 3/31/2004(UTC)
Posts: 2

Hi Andrew,

Thanks for the responce, but unfortunately I need to use the image box rather than the picture box for other reasons... one of which is that I can autostretch the image if it is part of a image box, but this is not possible in a picture box.

Any chance of fixing the bug, I'm guessing it's not a big one?

Many Thanks

Andrew
Andrew  
#4 Posted : Wednesday, April 07, 2004 11:33:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 863

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
I have replied it via e-mail...
Andrew  
#5 Posted : Thursday, April 08, 2004 7:37:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 863

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
If anyone experiences the same problem, download the most recent version of AVI Processor.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.