#ifndef MAINWINDOW_H__ #define MAINWINDOW_H__ #include #include #include class MainWindow : public QWidget { Q_OBJECT public: MainWindow(QWidget *parent = 0) : QWidget(parent) { QTimer::singleShot(1000, this, SLOT(timeout())); } virtual ~MainWindow() { } public slots: void timeout() { TCHAR className[256]; HWND hParent = (HWND)(effectiveWinId()); GetClassName( hParent, &className[0], 255 ); HINSTANCE hInstance = (HINSTANCE)(GetModuleHandle(NULL)); m_hWnd = CreateWindowEx( WS_EX_LAYERED | WS_EX_TRANSPARENT, className, className, WS_POPUP, 0, 0, 100, 200, hParent, NULL, hInstance, NULL ); ShowWindow(m_hWnd, SW_SHOWNA); QTimer::singleShot(1000, this, SLOT(timeout2())); } void timeout2() { DestroyWindow( m_hWnd ); /* Death after Qt5.2 */ } private: HWND m_hWnd; }; #endif /* ! MAINWINDOW_H__ */