60 QString className = description.name;
63 className = classNamePrefix() + className;
72 if (shouldDecorateWindowClassName(className, description.procedure))
73 className += QUuid::createUuid().toString();
75 if (m_registeredWindowClasses.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;
86 WindowClassIcons icons;
91 icons.icon =
static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
93 int sw = GetSystemMetrics(SM_CXSMICON);
94 int sh = GetSystemMetrics(SM_CYSMICON);
95 icons.iconSmall =
static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0));
96 wc.hIcon = icons.icon;
97 wc.hIconSm = icons.iconSmall;
99 wc.hIcon =
static_cast<HICON>(LoadImage(
nullptr, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
103 wc.lpszClassName =
reinterpret_cast<LPCWSTR>(className.utf16());
104 ATOM atom = RegisterClassEx(&wc);
106 qCWarning(lcQpaWindowClass) <<
"Failed to register window class" << className
107 <<
"(" << qt_error_string(-1) <<
")";
109 DestroyIcon(icons.icon);
111 DestroyIcon(icons.iconSmall);
115 m_registeredWindowClasses.insert(className, icons);
117 qCDebug(lcQpaWindowClass).nospace() <<
__FUNCTION__ <<
' ' << className <<
' ' << description <<
" atom=" << atom;
138 return GetClassInfo(appInstance,
reinterpret_cast<LPCWSTR>(name.utf16()), &wc) != FALSE
Singleton container for all relevant information.