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

Posted on 2010-09-05
Medium Priority
Last Modified: 2012-05-10
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?
Question by:luciliacoelho
LVL 30

Expert Comment

by:Olaf Doschke
ID: 33607119
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.
LVL 43

Expert Comment

ID: 33607446
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!
LVL 27

Expert Comment

ID: 33609052
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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 30

Expert Comment

by:Olaf Doschke
ID: 33609321
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.
LVL 27

Expert Comment

ID: 33609541
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.

Author Comment

ID: 33610381
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?
LVL 27

Accepted Solution

CaptainCyril earned 2000 total points
ID: 33610554
You put an OLECONTROL object on your form and assign "Microsoft Web Browser" or "WebBrowser  Control" when asked.

You have to call the Navigate or Navigate2 command to direct it to a local or internal URL.

Usually in my software I generate HTML files using my own engines: tables, charts, analysis, ... Bottom line they are HTML files.

When you have a WebBrowser on your FoxPro Form, you direct it to that HTML file.

Create a Visual FoxPro Web Browser Sample

How To Print Contents of the Web Browser Control from Visual FoxPro
LVL 30

Expert Comment

by:Olaf Doschke
ID: 33613851
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.


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Moore’s Law has proven itself time and time again since it was first introduced. So what’s next? Will Moore’s law continue to remain relevant, or will new technology take over and bring us the next big advancement in computing?
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question