Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playng an AVI file on a form

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi All

Can someone please point me in the right direction where I can find a very simple example or code for playing an AVI on a form without the "Stop" and "Play" buttons and a form that will start the AVI when the form is activated. The reason? When something else is going on in an application I want the user to know the program is still running so I can add the old filecopy.avi or filemove.avi (or any other appropriate AVI) to the form for something like this...

Do form updating

*My Code, and when its finished

_screen.activeform.release

Hope this makes sense and many thanks
KB When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
Two of the classes (SoundPlayer and VideoFrame) in the Visual FoxPro Samples\Classes\Samples.vcx class library make it possible for you to use the MCI (Multimedia Command Interface) to play multimedia files.

run the solutions example app to see demos and code. Attitude is Everything
 
Thanks danceman, I'll give a try
KB When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
keepingbusy

You need the MS Animation Control to be found in the list of ActiveX controls.

In the .Init event of your form, put :-

WITH THIS.oleFileMove
[tab].Open([avi\filemove.avi])
[tab].Play()
ENDW
HTH

Chris [pc2]
 
Sorry about this. But I've pasted the above into a form but it still doesn't seem to work. Lots of error messages etc. I know its me, can you explain step by step?
Thankyou for your time and patients (Seems a lot of hard work for something so small and easy)

KB When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
did you look at the demo example??

if you are using what Chris posted then your object references may be totally different. Attitude is Everything
 
KB,
First, Menu -> Tools -> Options... ->Controls (tab), choose the ActiveX Controls option button. Now scroll down to the "Microsoft Animation Control 6.0 (SP4)" - check this box, and click OK. Now with your form Open, click on the "book collection" in the Form Controls Toolbar (the Tooltip says "View Classes". Click on it, and choose ActiveX Controls. The toolbar should now be much shorter, and you should find this control on it. (Hover the mouse till the Tooltip says "Microsoft Animation Control 6.0 (SP4)" - click on it and then drop it on your form and move it and size it for the AVI file (60x270).

My test code in the Form Init() was:
Code:
WITH THIS.olecontrol1
    .Open("c:\Program Files\Microsoft Visual Studio\Common\Graphics\Videos\filemove.avi")
    .Play()
ENDWITH
The differences when compared to Chris's code was I didn't rename the control when I dropped on the form, and I used the AVI file where it was on my system.

Note: This will show the animation as soon as the form opens, and won't stop till you close the form.

Rick
 
keepingbusy

Apologies for not making clear that the code I posted would need modifying to suit.

Rick's detailed explanation should have resolved the question for you.

One tip about sizing the control to a specific .avi file - if you have no means of knowing the size of the image, change the .BackStyle to 1 - Opaque, and run the form.

You will then see how the image fits in the control. Adjust the dimensions of the control accordingly and then reset the .BackStyle to 0 - Transparent. HTH

Chris [pc2]
 
Thanks all
I'll give the advice a go over the weekend. I am very grateful for your time and effort.
Stay safe
KB When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
Hi Rick
Managed to have a look at the info you described and it works perfect. Amazing how simple some things are in life when you know how! Many thanks to all who contributed to this thread for which I'm grateful

KB in the UK
When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top