Solved

CreateDispatch Error

Posted on 1998-12-02
5
1,195 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
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 74
Creating Labels and Frequency list style reports in SAS code 9 98
WinWaitActive parameters 12 31
Window placement 17 80
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.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now