I am automating Word via the OLE interface. I have no issues with this when I am using this in a standard windows application (dialog based, SDI, or MDI). I am now developing a single threaded .DLL which is being called via a JSP page on a webserver (that is run by the command prompt so we do have screen interaction).
When I attempt to determine whether I have control of an instance of Word in this DLL, I attempt to get the HWnd and check it for NULL. When I do that, I end up getting a CO_E_NOTINITIALIZED ($800401f0) error with "Abort, Retry, Ignore". If I click ignore, the program keeps going and the program assumes Word is not running. At this point, my app is capable of starting a new instance of Word, but subsequent calls fail (whether it is to get the HWnd or do a file open, etc).
In DllMain, I am calling: