This may be the shortest "Bad Code" I've ever done, but it keeps on surprising me how many times I see this problem (people asked me questions about it twice in the past week). // BadCode18.cpp : Defines the entry point for the console application. #include
int _tmain(int argc, _TCHAR* argv)
hr = CoInitialize(0);
hr = document.CoCreateInstance(CLSID_HTMLDocument);
// BadCode18.cpp : Defines the entry point for the console application.
That's all it takes, I consciously chose not to add stuff to obfuscate the problem.
Btw, for those who've been reading this blog for a while, I covered this exact same issue in a different form a while ago.