Link to home
Start Free TrialLog in
Avatar of andrewmchorney
andrewmchorney

asked on

CreateDispatch Error

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.

ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andrewmchorney
andrewmchorney

ASKER

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
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.
Can you use CreateDispatch from a Windows Service.

Thanks
Aravind.
I don't see why not.