+ if (message == MYWM_TASKBARCREATED || message == MYWM_NOTIFYICON) {
+ if (QSystemTrayIconSys *trayIcon = handleTrayIconHash()->value(hwnd)) {
+ MSG msg;
+ msg.hwnd = hwnd; // re-create MSG structure
+ msg.message = message; // time and pt fields ignored
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ msg.pt.x = GET_X_LPARAM(lParam);
+ msg.pt.y = GET_Y_LPARAM(lParam);
+ long result = 0;
+ if (trayIcon->winEvent(&msg, &result))
+ return result;
+ }
+ }
+ return DefWindowProc(hwnd, message, wParam, lParam);
+}
+
+// Invoke a service of the native Windows interface to create
+// a non-visible message window.
+static inline HWND createTrayIconMessageWindow()
+{
+ if (QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface()) {
+ void *hwnd = 0;
+ void *wndProc = reinterpret_cast<void *>(qWindowsTrayconWndProc);
+ if (QMetaObject::invokeMethod(ni, "createMessageWindow", Qt::DirectConnection,
+ Q_RETURN_ARG(void *, hwnd),
+ Q_ARG(QString, QStringLiteral("QTrayIconMessageWindowClass")),
+ Q_ARG(QString, QStringLiteral("QTrayIconMessageWindow")),
+ Q_ARG(void *, wndProc)) && hwnd) {
+ return reinterpret_cast<HWND>(hwnd);
+ }
+ }
+ return 0;
+}
+
+QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object)
+ : m_hwnd(hwnd), hIcon(0), q(object)
+ , notifyIconSize(NOTIFYICONDATA_V2_SIZE), version(NOTIFYICON_VERSION)
+ , ignoreNextMouseRelease(false)
+
+{
+ handleTrayIconHash()->insert(m_hwnd, this);
+
+ if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) {