TroubleShooting

CoCreateInstance fails
One tactic to help deal with this is to replace CoCreateInstance with a call to CoGetClassObject, followed by an invocation of IClassFactory::CreateInstance. This will tell you whether the problem is in the location/activation of the class object, or the creation of an instance. For out of proc servers, remember that you need to create & register the proxy/stub pair to use an object
CoCreateInstance fails with error code 0x80040002, with my out-of-proc server? What's wrong?
Did you:
  1. Build the proxy/stub pair, including REGISTER_PROXY_DLL?
  2. Call regsvr32 on the resulting dll?
  3. Try starting the server & then connecting? (I.e., you can connect, but there are separate problems with activating your EXE?)
CoCreateInstance fails with some random error code
Use ErrLook to lookup the error (in msdev/something/bin), or look it up yourself in WINERROR.H
CoCreateInstace fails with error code 0x80080005, with my out-of-proc server? What's wrong?
Error code 0x80080005 means Server execution failed, which probably indicates that CoGetClassObject has failed. Try putting a MessageBox() into the program right after WinMain to confirm that the executable is located and started ok. If not, check the registry to make sure you're registering it correctly-- the correct path and the correct executable name. In particular, when working with VC++, VC++ will put the executable into a directory called "Debug", or "Release", or somesuch, but will run the exe. in the directory above that. Make sure to use the Project->Settings|Debug(Working Directory) option to be the correct directory when running the program with RegServer (assuming you use something like _getcwd to 'autoregister' the component