Flexgrid control can't be created on machines that haven't VC6 installed?

Hi everybody,

    I want to use the MSFlexGrid control in a doc/view vc++ program. The
control shows up perfectly on my machine, which has Visual Studio 6.0
installed. However, on those machines that don't have VS6 installed, the
control doesn't show up at all, even it I have the same control registered
on it.

    I first inserted this control to the project by using the Projects->Add
to Project->Components and Controls menu item. The IDE automatically created
the CMSFlexGrid class. Then I added a member variable to the view class:

     CMSFlexGrid m_grid;

And in the view's OnCreate() method, I addded this code:

int CSView::OnCreate(LPCREATESTRUCT lpCreateStruct)
 if (CView::OnCreate(lpCreateStruct) == -1)
  return -1;

 // TODO: Add your specialized creation code here
 CRect rc(10,10,300,200);
 m_grid.Create("gird","gird", WS_CHILD|WS_VISIBLE, rc,this, 101); // this

 return 0;

The control showed up on my machine. But it just couldn't be created on
those machine that haven't vs6 installed. The m_grid.Create() always returns
false, according to a debugging test.

Wierd is that if I just added the control to a dialog based application, and
added a member variable for the control using the class wizard, that is, let
the framework to do the things for me, the flexgrid control always shows up,
whether on my computer or on those.

Anybody could give me a hint? I'm really bewildered at this. Thank you very

Best regards,
Who is Participating?
Chandra VConnect With a Mentor ConsultantCommented:
Hai xiexiao,

Some of the redistributable controls supplied with Visual C++ 6.0 are licensed and require a license key to be dynamically created on machines that have not had Visual C++ installed, 'msflxgrd.ocx' is one of them. To get your problem solved see the following MSDN articles.



you need to add some staff to the others machines:4 at least(mfc42d.dll,msvcrtd.dll,mfco42d.dll)
Be sure you are trying to run the Release version of your code.  The other machines may not have the correct versions of the debug libraries.

On your computer, run the program (Debug version) and watch the trace screen.  It will show a list of all DLLs that are used and needed by your program (its dependencies).  Look at the file names very closely. All of these files must exist on any computer on which your program is executed.

-- Dan
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

xiexiaoAuthor Commented:
Shouldn't the program pop up a dialog box that certain dll can't located if the files are missing?
But it did not appear on the machines.
Any comments?
>>Shouldn't the program pop up a dialog box...
No, but in some cases, the system will do so.  In other cases, such as OCX's and their dependencies, or when LoadLibrary API is used, there will be no popup message uless the programmer provided it.

-- Dan
xiexiaoAuthor Commented:
That's it! cvallabhaneni.

The reason that the dynamic creation failed is that these controls need license keys!

The reason that the dialog based application is immune to this problem is that the resource editor has already got the license keys via IClassFactory2 interface and cached the license keys in .rc files, and it use them to create those controls.

Thank you very much, cvallabhaneni!

Best regards,

Hi all,

I have an mdi application and i am hving the msflexgrid in my dialog box, but it is just not showing up on some machines. i used some because the dialog box pops up well and the whole thing works in some computers, but on some the dialog is not at all popping up!!...all of these machines are vc 6. The Wierdest thing is  it was working on a particular machine and suddenly it is not on the same!!...any comments on this please, infact any comment and suggestions are very very much appreciated, i am trying to find out the reason, why working suddenly aint working!!!!

Thanks all
xiexiaoAuthor Commented:
Hi acheive,

This is due to the licence problem. When you create the msflexgrid control, you should specify it's license key. You may look up for IClassFactory2 for more inforamation related to this issue.

Are you sure it didin't come up in a Dialog-based application, not SDI or MDI apps?


yeah I am pretty sure!!...tell me how did you go about including the msflexgrid...I want to compare yours and mine, cos you said on dialog based it was workin!
xiexiaoAuthor Commented:
Actually, some MS ActiveX controls require license key when they are created. However, you may also use the IClassFactory2 interface to get the license key out. When you insert such controls in dialog, the VC++ IDE will automatically query out the license key and save it somewhere and when the dialog is created, the license key will be automatically used.

But when you create SDI or MDI apps, things are different. You need to query out the license key using some other programs and then hard-code it into your apps' Create method. Otherwise the control won't be created successfully.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.