Solved

CreateDispatch Error

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WinWaitActive parameters 12 31
sumNumber challenge 16 137
Smart Camera scanning and reading information 3 113
Authenticate using sesu from script 7 54
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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