You need to create two different *.dll targets with the same Qt package (I have tested it with Qt 5.14.1 and Qt 5.14.2). Load Target_A and all is fine. Now load Target_B and you will end up in qErrnoWarning () in file "qwindowscontext.cpp" in method "QWindowsContext::registerWindowClass".
ATOM atom = RegisterClassEx(&wc);
The problem is that Target_B needs to register WNDCLASSEX which are already registered form Target_A. It has worked in previous version (Qt 5.13).
Here is the problematic bug/source
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE && wcinfo.lpfnWndProc != proc;
GetClassInfo () will return a BOOL. And the source is assuming it is fine with TRUE. But it is not. MSDN tells us
"If the function finds a matching class and successfully copies the data, the return value is nonzero."
In fact the result code is something like 4050. Which is nonzero. A BOOL is defined as an int. TRUE will not help here. The fix is
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) > 0 && wcinfo.lpfnWndProc != proc;
"> 0" instead of "== TRUE"
I hope that helps.
|For Gerrit Dashboard: QTBUG-84005|
|300409,2||Windows QPA: Fix window class name clash when mixing Qt libraries||dev||qt/qtbase||Status: MERGED||+2||0|
|301029,2||Windows QPA: Fix window class name clash when mixing Qt libraries||5.15||qt/qtbase||Status: MERGED||+2||0|