I've following Microsoft's documentation, for dealing with DAO when you have a secured database. You basically have to initialize Dao yourself with AfxDaoInit(), and then setup to system MDW for access security.
I'm trying to do this in a Out of Process Com server (EXE), that has called CoInitializeEx(COINIT_MULTITHREADED) to provided a multi-threading COM interface. This server is a singleton.
The problem is that AfxDaoInit() calls CoInitialize() which calls CoInitialize(). Microsoft documents that CoInitialize() simply calls CoInitializeEx(COINIT_APARTMENTTHREADED).
By calling this, it attempts to change the threading model after initialization and returns an error. This is a documented error condition.
This problem did not show up until I installed NT Service Pack 4, which I guess properly detects the threading model change.
My question is, how does one use Dao within a multi-threaded out of process com server? The design of the object is thread safe, DOA is only called and used during an initialization process that is run only once.