|
-
Jun 27th, 2004, 11:34 AM
#1
Thread Starter
New Member
Exporting and playing an AVI file [Solved]
Hi all. I am trying to do a program that will do a few things and then delete a few files not needed anymore. I want to display the windows page flying from folder to the dustbin and here is my problem.
In the VB directory you can find this AVI file (FILEDELR.AVI I think is the name), so there is no problem to play it with an animation control but my problem is to export this AVI file along with my program. I don't want to have two files because of size and order.
If I use an OLE object container, when I export the video with the SaveToFile method, it is not playable by the Animation control and either by Windows Media (I think exporting from OLE object includes information about links an so on that might do the file ilegible to usual AVI players)
What I am trying to do now is (I am a little ashame of this, because it's like a kick in the arse of programming ) is opening the AVI file via the Notepad, copying the file contents (the 33ÿ f3ÿ ™3ÿÿ stuff ) to an invisible TextBox in the main form of my program (the AVI file is only 14 KB so there is no size problem) and when this form opens, exporting the contents of this TextBox to a file called video.avi via a put instruction.
The problem? Well, it doesn't work either. If you try to open it with the Windows Media Player it displays a message about unknown class or something like that, I don't remmember the message correctly. again
I have even made a small rutine to compare both files (the generated AVI and the original AVI file) character by character and both are the same, so I don't know what is wrong.
Any idea? Any alternate way to solve this? Is there any other way to store this AVI file along with the mother program? If so, please let me know because this is driving me nuts...
Thanks a lot, you VB fans
Last edited by xupixaxi; Jun 27th, 2004 at 01:19 PM.
This is Ground Control to Major Tom!!!...
Your circuit's dead...There's something wrong!!!
-
Jun 27th, 2004, 12:05 PM
#2
You could store it as a resource file and either save it to the hard drive then load it back in or i think its possible to construct the resource file into an array of bytes then basically loop through the array and play the movie without having to save first to the HD.
-
Jun 27th, 2004, 12:24 PM
#3
Thread Starter
New Member
Resource file? what is that? Could you be more specific? I am rather new into VB and maybe I haven't made it to that chapter I never heard about that.
If it is a resource file is it included in the code or how does this work?
This is Ground Control to Major Tom!!!...
Your circuit's dead...There's something wrong!!!
-
Jun 27th, 2004, 01:16 PM
#4
You can add file(s) (resource) to your project. Go to the add-in manager and click on resource editor, you will see a green icon appear in the menu bar. Well open the resource editor and you can add any type of file you like. For a sound file you would have to add it as a custom file.
Example : Load a bmp directly into a picturebox
picture1.picture = loadrespicture (101,vbresbitmap)
-
Jun 27th, 2004, 01:17 PM
#5
Thread Starter
New Member
Solved...thanks, I feel so stupid now as I learned about resource files...hehehe
This is Ground Control to Major Tom!!!...
Your circuit's dead...There's something wrong!!!
-
Jun 27th, 2004, 03:20 PM
#6
This will play the AVI from the resource file without having to save to the HD first.
Uses the MS Animation Control.
VB Code:
Option Explicit
Private Const WM_USER = &H400&
Private Const ACM_OPEN = WM_USER + 100&
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
Private Sub Command1_Click()
Dim ResID As Long
ResID = 101
SendMessage Animation1.hwnd, ACM_OPEN, App.hInstance, ResID
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|