The error code is 'CO_E_NOTINITIALIZED'. You have to call 'CoInitialize( NULL);' before creating the control (if you're using MFC, the call is 'AfxOleInit();')
Main Topics
Browse All TopicsI am programming in VC++ 5 in NT. I've included a dialog in a regualr dll; and in the dialog there is an ole control. When I try to create an instance of the dialog I get the following error in the debug window:
CoCreateInstance of OLE control {53D4F583-DE5B-11D0-8B6C-4
>>> Result code: 0x800401f0
>>> Is the control is properly registered?
Warning: CreateDlgControls failed during dialog init.
Warning: Dialog creation failed!
The control is already registered in the system (I have used it in a normal application). What do I need to do to register on line (I suppose) the control for the dialog to work correctly??
;)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
BTW: This call is used to initialize athe OLE libraries, no function related to COM/OLE will work unless 'CoInitialize()' is called. The best place for this call is in the constructor of your dialog, and 'CoUninitialize()' should be placed i the dialogs destructor, hence. And: You could also use 'OleInitialize ( NULL);' ;-)
>>I believe that CoTaskMemAlloc and CoTaskMemFree will
>>work without the COM library having been initialized
Nope, they won't - the COM libraries' heaps are allocated when the DLLs are initialized.
BTW: 'OleInitialize()' & 'AfxOleInit()' are mainly wrappers around 'CoInitialize()' - the just perform a few other things (see the source of 'AfxOleInit()')
I am using MFC (initialized with AfxOleInit();) and now when I create an instance of the dialog the control registered correctly; But still the control does not seem to work. It seems that beeing inside the regular dll afects the ole control in a stange way, because I'vw used the same control in another non dll application and it works fine.
Business Accounts
Answer for Membership
by: NinPosted on 1999-03-31 at 11:28:58ID: 1422580
Edited text of question.