Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 22nd, 2004, 05:10 PM
Registered User
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jonty_11
Default Unable to Initial COM Object

Hi All,

   I trace my code and realize that it is unable to enter this function:
hr = CoInitialize(NULL); and also the one below
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));

in file COMIP.H

hence hr get a negetive value. and it gives an error while attempting to write the error :
if (FAILED(hr) && (hr != E_NOINTERFACE)) {


Appears that it is unable to create COM instance, appreciate any help I get..
Old April 22nd, 2004, 05:17 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts

I am a bit new at this but have been dealing with it lately and ran across similar problems due to AfxOleInit(). Check to ensure that you have AfxOleInit(); include prior to the AfxEnableControlContainer(); statement.
In the ::InitInstance() function.

Hope this helps.

Larry Asher

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to cast object of type 'TheBeerHouseSection DyerOppenheimer BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 June 10th, 2008 12:13 PM
Unable to cast object of type galua SQL Language 3 January 9th, 2008 01:31 PM
Unable to create Excel object neha_jn Beginning VB 6 1 September 28th, 2004 10:06 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.