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

Posted on 2001-06-21
Medium Priority
Last Modified: 2013-11-20
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,
Question by:xiexiao
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2

Expert Comment

ID: 6217239

you need to add some staff to the others machines:4 at least(mfc42d.dll,msvcrtd.dll,mfco42d.dll)
LVL 49

Expert Comment

ID: 6217303
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

Author Comment

ID: 6220751
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?
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

LVL 49

Expert Comment

ID: 6221105
>>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

Accepted Solution

Chandra V earned 400 total points
ID: 6223579
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.



Author Comment

ID: 6227432
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,

Expert Comment

ID: 6574883

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

Author Comment

ID: 6577974
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?


Expert Comment

ID: 6581096

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!

Author Comment

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

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

800 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