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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include AVI file with project

Status
Not open for further replies.

chriscboy

Programmer
Apr 23, 2002
150
GB
Hi,

I have included a small AVI called filemove.avi within my project. However when I try and reference this file to play it I always get a file not found error. How do I reference the file in my code. Currently I have used two methods

1: Full path to the original file:
lcFile = "c:\work\vfp\ems\multimedia\filecopy.avi"
MyForm.VCR.Open(lcFile)

2: Just the file name:
lcFile = "filecopy.avi"
MyForm.VCR.Open(lcFile)

Method 1 works find on my development machine, but not anywhere else. Method 2 does not work at all.

I don't know whats going on as usually method 2 works with my bitmaps?!? Any ideas folks?
 

Chris,

Don't hard-code the path with the filename. Instead, use SET PATH to point to the folder containing the AVI on the development machine.

When you build the project, make sure that the AVI is included in the build. Provided you don't have a hard-coded path in your Open method, VFP should find it.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hi,

I have changed the code to read:
lcFile = "filecopy.avi"
MyForm.VCR.Open(lcFile)

When or where do I issue SET PATH ? I have included the AVI with my project, compiled and run it and it still comes up with the same error (L1443 E1429 OLE IDispatch exception code 0 from Animation: File not found..)

I am using the MSComCtl2.Animation.2 control. If you want to the class code is in this thread :
Thanks

Chris
 

Chris,

Sorry ... I misunderstood your original question. My fault. I now see what's going on.

It's the AVI component that is failing to find your file, not your VFP code. Setting PATH won't help with that.

Essentially, you've got to exclude the AVI file from your project (if the file is present in the project window, right-click on it and choose Exclude). Then, be sure to distribute the file with the application.

Place the file in the VFP default directory (which, by default, will be the directory containing the EXE, but which you might have altered using SET DEFAULT). When you call the AVI component, do so like this:

lcFile = FULLPATH("filecopy.avi")
MyForm.VCR.Open(lcFile)

I think that should solve it, but perhap you could try it and report back.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
This works fine. It's a shame the AVI component can't use files included in the project. Still you can't win them all!

Thanks for your help Mike.

Chris
 

Chris,

It's a shame the AVI component can't use files included in the project.

That's generally true of third-party components. After all, they are looking for a physical file, and don't know anything about VFP's peculiar way of binding files inside EXEs.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Would it be possible to include the AVI in the exe, then use FileToStr()/StrToFile() to copy it out temporarily during program execution? I do that with gifs that I include in some reports (the VFP8 report writer didn't like referencing the gifs inside the exe).

In my main app object, I have:
Code:
IF FILE('logo.gif')
	SET SAFETY OFF 
	lcstr = FILETOSTR('logo.gif')
	STRTOFILE(lcstr,SYS(5)+ADDBS(SYS(2003))+'logo.gif',0)
	SET SAFETY ON 
	this.clogo = 'logo.gif'
ELSE
	this.clogo = SPACE(0)
ENDIF

Then elsewhere, I use oApp.cLogo to reference the gif.

Would that work for you?

-- frank~
 
I use a table included with the finished projects.
It has a binary memo field which I append binary files into - such as tables, executables, fonts, dll files or anything else I want written to the local install.

This works very well. I even use it to provide online updating for most of my apps now.


Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top