60 QString className = description.name;
62 if (description.shouldAddPrefix)
63 className = classNamePrefix() + className;
72 if (shouldDecorateWindowClassName(description))
73 className += QUuid::createUuid().toString();
75 if (m_registeredWindowClassNames.contains(className))
78 const auto appInstance =
static_cast<HINSTANCE>(GetModuleHandle(
nullptr));
81 wc.cbSize =
sizeof(WNDCLASSEX);
82 wc.style = description
.style;
83 wc.lpfnWndProc = description.procedure;
84 wc.hInstance = appInstance;
85 wc.hbrBackground = description.brush;
87 wc.hIcon =
static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
89 int sw = GetSystemMetrics(SM_CXSMICON);
90 int sh = GetSystemMetrics(SM_CYSMICON);
91 wc.hIconSm =
static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0));
94 wc.hIcon =
static_cast<HICON>(LoadImage(
nullptr, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
98 wc.lpszClassName =
reinterpret_cast<LPCWSTR>(className.utf16());
99 ATOM atom = RegisterClassEx(&wc);
101 qCWarning(lcQpaWindowClass) <<
"Failed to register window class" << className
102 <<
"(" << qt_error_string(-1) <<
")";
104 m_registeredWindowClassNames.insert(className);
106 qCDebug(lcQpaWindowClass).nospace() <<
__FUNCTION__ <<
' ' << className <<
' ' << description <<
" atom=" << atom;
132 return GetClassInfo(appInstance,
reinterpret_cast<LPCWSTR>(name.utf16()), &wc) != FALSE