OLE Container in a DLL

I'm developing a DLL that simply shows a frame window containing a RemoteData Control and a DBGrid Control. I have initialized my app with AfxEnableOLEContainer and my app runs fine, but the RemoteData and DBGrid controls do not appear. The debug output message is the following:

CoCreateInstance of OLE control {00028C00-0000-0000-0000-000000000046} failed.
>>> Result code: 0x800401f0
>>> Is the control is properly registered?
Warning: CreateDlgControls failed during form view init.
Detected memory leaks!
Dumping objects ->
occmgr.cpp(646) : {241} normal block at 0x00412580, 28 bytes long.

The line 646 of occmgr.cpp is the following:

pBindings = new CDataBoundProperty(pBindings, dispid, ctlid);

What's the problem?

Thank you in advance.
opaciosAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

galkinCommented:
The problem is that control you aretrying to create is not properly registered on your computer. Use regsvr32.exe utility founf in system directory to register control. To do this launch regsvr32.exe with command line as full path to control file. Yuo must get message box that your control registration has been succeeded. You can also use ActiveX controls test container to rister these controls by invoking "Register control" menu and browsing to DBGrid control DBGRID32.OCX if your are working in 32 bit platform or DBGRID16.OCX if you are working in 26 bit platform file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
opaciosAuthor Commented:
Thanks for your fast answer.

I've registered the two controls, and the problem persists. I think that it's not the problem, because these controls work fine in an usual MFC application. The problem only appears when including the controls in a DLL.
0
galkinCommented:
If contrls are properly registered be sure that you called AfxOleInit() and AfxEnableControlcontainer() in your application InitInstance function
0
opaciosAuthor Commented:
Thanks for your answers.

I was calling AfxOleInit and AfxEnableControlContainer in the DLL application object InitInstance function, but they have to be called from the application that imports the DLL.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.