Solved

CreateDispatch Error

Posted on 1998-12-02
5
1,215 Views
Last Modified: 2013-11-20
I am working on a dll that has com objects and a client program that talks to the dll. In the client program, when I make a CreateDispatch call and if I am in the debugger, I am getting the following message displayed :

Warning: CreateDispatch returning scode = CO_E_NOTINITIALIZED ($80040F0)

What will cause this error ?

Thanks,
Andrew

More points to be awarded when answer solves this problem if  I get an answer before the instructor responds to my email.

0
Comment
Question by:andrewmchorney
[X]
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
  • 3
5 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 10 total points
ID: 1325699
You should call CoInitialize or CoInitializeEx before calling CreateDispatch for the first time.

Cheers,

Raymond.
0
 

Author Comment

by:andrewmchorney
ID: 1325700
Raymond

I will be doing that tonight. Since I do not have my book with me, what is the difference between the 2 calls.

Thanks for the quick response.

Andrew
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1325701
The MSDN help says "New applications should call CoInitializeEx instead of CoInitialize. "

HRESULT CoInitialize(  LPVOID pvReserved  //Reserved; must be NULL);

HRESULT CoInitializeEx(  void * pvReserved,  //Reserved
  DWORD dwCoInit      //COINIT value);

dwCoInit
[in] Flags specifying the concurrency model and initialization options for the thread. Values for this parameter are taken from the COINIT enumeration. This may contain any combination of values from the COINIT enumeration, except that the COINIT_APARTMENTTHREADED and COINIT_MULTITHREADED flags cannot both be set.

Cheers,

Raymond.
0
 
LVL 3

Expert Comment

by:aravindtj
ID: 15154839
Can you use CreateDispatch from a Windows Service.

Thanks
Aravind.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 15157227
I don't see why not.
0

Featured Post

Industry Leaders: 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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

691 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