This isn't exactly a COM forum :P, but...
were I to guess I'd say that in your driver (your main function or whatever you're actually trying to use the ClassFactory from) you're probably missing the "CoInitialize(null)" statement. I recently forgot to add that in and had my HRESULT on classfactory returning failure; hence my guess.
If not that, I'll look over it again, but I'm no expert by any means.
EDIT:
Congrats on your quick work in COM! Kind of a cool concept/programming style when you learn about it.
Bookmarks