HWND appwnd;
appwnd = (HWND)this->winId();
QString ClassName("Qt5QWindowIcon");
QString AppName = QStringLiteral("GG");
LPCWSTR app = reinterpret_cast<LPCWSTR>(ClassName.data());
LPCWSTR appCaption = reinterpret_cast<LPCWSTR>(AppName.data());
appwnd = ::FindWindow(app, appCaption);
HWND hwnd;
hwnd=(HWND)myWidget->winId();
qDebug() << "----------创建预览窗口-------------"<<hwnd;
qDebug() << "----------创建预览窗口-------------"<<(unsigned long)hwnd;
qDebug() << "----------创建预览窗口-------------"<<myWidget->winId();
qDebug() << "----------创建预览窗口-------------"<<this->winId();
博客地址:https://blog.csdn.net/xiang__liu,https://www.cnblogs.com/xiang--liu/