> I'm amazed that window related calls like ::MessageBox are even allowed in > DllMain, I certainly wouldn't expect them to work!
Actually, they aren't - and that for a good reason. If it works, it's plainly by accident. Rationale: Creating a HWND in Windows might trigger the loading of DLLs. However, a non-recursive mutex (it's commonly called "LoaderMutex") is held by the system during processing of DllMain. Because of that, calls to DllMain are serialised in a queue, which results in: "If you load a dll from within DllMain, you can be sure it is not yet initialized". I remember at least those 2 scenarios, where I've had much trouble with this: - Mixing managed and unmanaged code in one application. - Delayed-Loading of DLLs. >From http://msdn.microsoft.com/en- us/library/windows/desktop/ms682583%28v=vs.85%29.aspx > Calling functions that require DLLs other than Kernel32.dll may result in problems that are difficult to diagnose. For example, calling User, Shell, and COM functions can cause access violation errors, because some functions load other system components. Conversely, calling functions such as these during termination can cause access violation errors because the corresponding component may already have been unloaded or uninitialized. > Because DLL notifications are serialized, entry-point functions should not attempt to communicate with other threads or processes. Deadlocks may occur as a result. Sascha _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest