I have a 1mb .wmv file, is there any way I can get it to be embedded or placed onto my form and it will be played at form_load?
Printable View
I have a 1mb .wmv file, is there any way I can get it to be embedded or placed onto my form and it will be played at form_load?
You can add it to a resource file in your project. Then extract it to a temp file
at runtime for playing. When the program closes, kill the file. Also, make it a hidden file.
Sounds good enough. You too busy to help with a small walk-thru?
Here is some sample code of mine that will extract an avi file from a resource file.
Use the Custom format for adding wmv files.
"Search" is the name of the resource.
VB Code:
Dim bytResData() As Byte 'LOAD AVI FILES FROM RESOURCE FILE bytResData = LoadResData("Search", "CUSTOM") Open App.Path & "\Search.avi" For Binary Access Write As #1 Put #1, , bytResData Close #1
To add the resource editor add-in to vb...
Add-Ins > Add-In Manager > Select VB 6 Resource Editor, check both "Loaded/Unloaded" and "Load on Startup" check boxes.
Then to add the file to the resource file...
Click either the green little "rubicks cube" looking thing or Project menu > Add New Resource File...
Click the "Add Custom Resource ..." button and browse to your wmv file.
Then click open.
Then select it in the Editor treeview list and rename it to something meaningful.
The name will be used to reference your "CUSTOM" resource file when you extract it like I posted earlier.
HTH
i have all that done, what component do i need to add to the form to play the movie?
cheers
up . . .
Lets see,... you could use Windows Media Player since it is included with
Windows. But you may have issues with versions between window versions.
Not sure if you can distribute it? But the user can download it.
I'm sure there are other ways too though.
meh..to get it to play on a form?
Yes, Project > Components > Controls tab > select Windows Media Player.
Then in its custom properties you can turn off the visibility of the controls so
its just a screen.
:thumb:
followed those instructions exactly, no luck
How far did you get? Did you get the resource file created or are you stuck using wmp?
http://www.vbforums.com/attachment.p...chmentid=33359
http://www.vbforums.com/attachment.p...chmentid=33360
what happened to the default of showing pictures automatically? I noticed it last night. Is it something to do with 2 files? I added an image as the second file last night, and it didn't show in my post.
If you attach only one image, it will display. If you attach two or more it wont.
Or you can use the img tags. :D
that was it. the zip file was first, and the jpg was second. I didn't bother using a tag, though. Wasn't necessary, I figured, and it was late.
i added th e resource etc then the windows media player component and then got stuck :)
Once you have added the player to your form click the custom properties and
set the important ones like source and control settings etc.