[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1020
  • Last Modified:

Distributing MSChart & using in IE 5.0

I want to use the MSChart ocx and embed it in a web page.   On my DEVELOPMENT machine (Frontpage, VC++ 5.0, VB 5.0, etc) everything appears to be working wonderfully.

The web page has an <OBJECT> tag with the MSChart class id and CODEBASE referring to http://activex.microsoft......./MSChart.cab

Now, on my TEST machines (one NT 4.0 sp5 & one Win 98) when I open the web page, a dialog pops up asking about DL and running signed control MSChart blah blah.   I click OK, and the MSChart control is installed on the test machine(s).   (ALL machines are running IE 5.0).  However, IE does not display the MSChart control, but instead simply shows the box with the crappy red "X" indicating that the control failed to load and run.

I know what you are thinking - possibly the control was not registered.
- Nope, the control was correctly registered on both test machines.

How about this one - possibly dependent DLLs and OCXs were not installed.
- Nope, it would appear that all dependent DLLs and OCXs were also installed.   It actually turns out that the the MSChart control is not dependent on any other DLLs or OCXs.

Could I be wrong about no other dependent OCXs or DLLs?
-Possibly, but when I ran IE through Visual C++, I noticed that no other pertinant DLLs were loaded.  

What about the VB runtime DLLs?
-Installed those for good measure.

At this point I wrote both a VB exe and a VC++ exe that creates a MSChart control USING THE VISUAL TOOLS.   i.e, in VB I plopped a MSChart control on a VB form and I did the same for the VC++ exe.   Guess what - it worked on both the DEVELOPMENT and TEST machines.

With this in mind, I created a new dialog based VC++ project and attempted to create an instance of the MSChart control using CWnd::CreateControl.  It worked on the DEVELOPMENT machine but didnt work on either of the TEST machines.

Now, at this point I became VERY frustrated, so I installed VB 5.0 on the NT 4.0 TEST machine.   Guess what happened...it worked (both the web page and the aforemention example (the CWnd::CreateControl one) that previously failed)! <grumble>  I figured that it worked with VB 5.0 installed - lets uninstall VB 5.0 from the TEST machine and attemped the to run the test again.   It continued to work (of course many of the VB 5.0 dlls and registry changes were intact even after I performed the uninstall).

So, here is what I am left with.

1.   MSChart is easily redistributable when it is placed on a dialog or form.
2.   CWnd::CreateControl doesnt work with MSChart unless VB 5.0 has at one point been installed.
3.   VB 5.0 install does some registry magic or installs some dependent DLL that I am not aware of.
4.   Apparently, there is some difference (as far as ActiveX and COM is concerned) between placing an ActiveX control on a dialog (form) and creating one programmatically.
5.   I am going nuts trying to solve this problem.
6.   Depending on the responses to this question, I willing to up the ante on this question to a great number of points.

Thank you all in advance for your responses.


1 Solution
*Toss* the M$Chart control. You can write your own graphics easily using nothing more complex than a PictureBox. This will both lighten the install, give you better quality output, give you the ability to print and completely eliminate the hassels you're having.

If you use the .Scale and .Line commands in a PictureBox you can rapidly duplicate all of the functionality of the M$Chart control and even go beyond it's limitations.

VB activeX controls are licensed for the development box only. IE's license manager will not display a unlicensed control. You have to create a .LPK file from the tool
lpk_tool.exe located on the vb install cd under common/tools/vb/lpk, then install that file on the server running the htmp page and add the following code to the html page
 <object CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331"   width="50" height="50">
    <param name="LPKPath" value="FileName.lpk">
yoffeAuthor Commented:
Very nice ANSWER, hes - worked like a charm.   For a 50 point bonus, if I set CodeBase for the MSChart control to:


will I get all the MSChart control dependencies?   If not, what dependencies am I missing?
Yes you will, I checked when I had the same problem with msflexgrid on one of my pages. All the dependencies were there.
hi, yoffe
   send your solution to me , ok? my email address is  y1_abc@263.net


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now