Get HWND on windows with Qt5 (from WId)

前端 未结 5 1186
梦如初夏
梦如初夏 2020-11-29 07:00

I am trying to convert a Qt4 Application to Qt5. The only thing I couldn\'t figure out is how to get the HWND of a Widget. The program uses EcWin7 to show the progr

5条回答
  •  春和景丽
    2020-11-29 07:43

    winId() worked for me on Qt 5.1 at least it has the same value when I'm using

    bool Widget::nativeEvent(const QByteArray & eventType, void * message, long * result)
    {
        MSG* msg = reinterpret_cast(message);
        qDebug() << msg->hwnd;
    
        return false;
    }
    

    and

    qDebug() << winId();
    

提交回复
热议问题