Solved

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

Posted on 2001-06-21
10
431 Views
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
line


 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
much.

Best regards,
Allan
0
Comment
Question by:xiexiao
  • 4
  • 2
  • 2
  • +2
10 Comments
 

Expert Comment

by:Andrian
ID: 6217239

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

Expert Comment

by:DanRollins
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
0
 

Author Comment

by:xiexiao
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?
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 49

Expert Comment

by:DanRollins
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
0
 
LVL 2

Accepted Solution

by:
Chandra V earned 100 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.

http://support.microsoft.com/support/kb/articles/Q151/8/04.ASP

http://support.microsoft.com/support/kb/articles/Q151/7/71.ASP
0
 

Author Comment

by:xiexiao
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,
xiexiao
0
 

Expert Comment

by:acheive
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
0
 

Author Comment

by:xiexiao
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?

Xiexiao
0
 

Expert Comment

by:acheive
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!
0
 

Author Comment

by:xiexiao
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.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 93
Whole sheet autoscrub still needed 19 50
conditional code and condition difference 9 82
Making an alias 7 95
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

777 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