Link to home
Start Free TrialLog in
Avatar of luciliacoelho
luciliacoelhoFlag for Portugal

asked on

what are the extensions files possible to active with a object olecontrol

I want to put a image running ( video, power point file, etc ) in a VFP form with a olecontrol field. What are the extensions files possible to active with a object olecontrol?
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Olecontrol has to do with ole (activeX controls), this only is indirectly related to file extensions.

Oleboundcontrol is capable to show ole objects, not directly files. oleboundcontrols are always bound to general fields and you rather should stay away from that.

In regard of the files supported, the help on APPEND GENERAL applies. It says: "FROM FileName
Specifies the file containing the OLE object. You must include the entire file name, including its extension. If the file is located in a directory other than the current default directory, include the path with the file name."

So you can embed files with ole objects in them.

help continunes: "CLASS OLEClassName
Specifies an OLE class for an OLE object other than the default class.

You can specify a class name when the file extension for the file containing the OLE object is different from the default extension and you want to force the behavior for the class. If the default extension can be used by multiple Automation servers, include the class to specify a particular server."

So what you need is an ole automation server associated with the file you want to display. That's not available for any video type for example. Video handling in windows today is not depending on ole automation servers.

You should rather try a different approach than using olecontainer/oleboundcontrol. Better look out for specific ActiveX controls you can embed into your form and redistribute.

Bye, Olaf.
Wow, I've started to write the answer then I've been disturbed ... and much better answer is here.

So, I can just agree, it is perfect!
What I do in such a case is to create the document in a file and then open it in OLECONTROL (XLS, PPT, DOC, ...). Only MSGraph which I APPEND GENERAL and change its parameters (ChartType, Colors, ...) and then display the OLECONTROL from the General Field.

There are samples in solution.app that ship with FoxPro.

Task Pane/Solution Samples/OLECONTROLS.
Thanks pcelba,

one situation, where olebound control is acceptable is, if you create a cursor and append general to it to temporarily make some ole object available, especially for reports.

In regard to office documents, I rather open the original application with a file for the user to work with. A Doc for example looks odd in an olecontrol, even if you set the backcolor white.

Bye, Olaf.
In my applications, I use RTF controls, TreeView, MSGraph, WebBrowser as embedded in forms. I tried working with Excel slapped on a FoxPro form. It needs work and I don't like it when the menu changes.

Regarding Office Documents, they all open in their own applications as Olaf does it.

The best thing to display whether table, document or graphics is HTML inside a Webbrowser control and gives you more of an internet look that a desktop application which almost everybody prefers these days.
Avatar of luciliacoelho

ASKER

thanks for all the comments.
The CaptainCyril solution is what i prefer now, but how can i creat a webbrowser in a form?ccan you give me a example code?
ASKER CERTIFIED SOLUTION
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can directly use the webbrowser control. Go to Tools->Options and in the Controls tab of the Options dialog select ActiveX controls. Scroll to Microsoft Web Browser and select it. Set as default and close Options.

All controls selected within the list appear on the ActiveX Controls tab in the form controls toolbar. So choose View->Toolbars and select the form controls. You can also do so when in the form designer or class designer. Only in one of these the form controls toolbar buttons get active. The second button is the "View Classes" button. Clicking it let's you choose a) Add any VCX to display it's classes, b) Standard to get native standard classes or C) ActiveX controls, which then lists all the activeX controls you chose in the options dialog.

Now you can add one of these ActiveX controls to a form or class, like you can with standard controls or any other foxpro class.

Another option is the Toolbox, which does not only host controls or other classes, but also text scraps and more, you can put different stuff into the favorites category, define new categoreis and organize all your own classes, ffc classes, etc. as you like for usage in programming and form/class design. Rightclick on the Toolbox and choose Customize Toolbox to organize the toolbox.

Any way, once you have ActiveX controls on the toolbox or the form controls toolbar you can get it from there to a form.

If you choose the olecontrol you always need to specify which one each time, in the end it's the same, but I rather prefer to drag the control I want instead of using the olecontrol and each time pick one control from the list.

Bye, Olaf.