CoCreateInstances failes when called twice
Posted on 2003-11-20
I'm having all sorts of fun today jkr/dex. Lend me your thoughts on this also please.
Ok, example based in reality, simplified to make this clear:
This is how the two CoCreateInstance calls work (i replaced DirectInput8Create with this to see if it made any difference so assume the failure with either call).
I run the normal program executable, which creates an instance of directinput8, this yields fine results with either call and I get my interface. Then I run the service, which also does the same code to start directinput, and also yields good results and gets the interface ... and then they both are successful through the device creation/etc.
How this does not work:
Run the service first, and then the program. OR Run the program, and then the program itself again. I get the most general COM error you can get, so that's not much help. The code is 99% the same.
The service does not seem to care what context you give it, INPROC_SERVER, ALL, etc, but the program only accepts INPROC_SERVER and gives you the wonderful class not registered error otherwise.
I'm all ears :)