Solved

CreateDispatch Error

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

708 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

13 Experts available now in Live!

Get 1:1 Help Now