久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Qt5 在 Windows 上獲取 HWND(來自 WId)

Get HWND on windows with Qt5 (from WId)(使用 Qt5 在 Windows 上獲取 HWND(來自 WId))
本文介紹了使用 Qt5 在 Windows 上獲取 HWND(來自 WId)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試將 Qt4 應用程序轉換為 Qt5.我唯一想不通的是如何獲得小部件的HWND.該程序使用 EcWin7 在 win 7+ 的任務欄圖標上顯示進度,但需要 HWND.將 Q_WS_WIN 更改為 Q_OS_WIN 后,lib 本身似乎可以正常編譯)在 Windows 上的 Qt4 中,WId 只是 HWND 的 typedef,所以這沒問題.在 Qt5 中,情況不再如此.我發現了一些 郵件列表發布 可以提供線索,但它似乎 QPlatformNativeInterface 不再是 Qt5 公共 API 的一部分.

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 progress on the taskbar icon on win 7+ but expects a HWND. The lib itself seems to compile fine after changing Q_WS_WIN to Q_OS_WIN) In Qt4 on Windows WId was just a typedef for HWND, so this was no problem. In Qt5 this is not the case anymore. I found some mailing list posting that could give a clue but it seems QPlatformNativeInterface is not part of the public API of Qt5 anymore.

程序調用 EcWin7.init(this->winId()); 并且我需要某種方式將此 ID 轉換為 HWND id 或其他方式得到這個.

The program calls EcWin7.init(this->winId()); and I need to some way to convert this ID into the HWND id or some other way to get this.

推薦答案

在 Qt5 中 winEventnativeEvent 取代:

In Qt5 winEvent was replaced by nativeEvent:

bool winEvent(MSG* pMsg, long* result)

現在

bool nativeEvent(const QByteArray & eventType, void * message, long *result)

并且在 EcWin7::winEvent 中,您必須將 void 轉換為 MSG:

And in EcWin7::winEvent you have to cast void to MSG:

bool EcWin7::winEvent(void * message, long * result)
{
    MSG* msg = reinterpret_cast<MSG*>(message);
    if (msg->message == mTaskbarMessageId)
    {
      ...

我能夠讓應用程序運行!只需替換:

I was able to get the application to work! Just replace:

 mWindowId = wid;

 mWindowId = (HWND)wid;

這篇關于使用 Qt5 在 Windows 上獲取 HWND(來自 WId)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 秋霞av国产精品一区 | 伊人色综合久久天天五月婷 | 中文字幕国产精品 | 男女羞羞视频在线 | 黄色片免费 | 精品免费在线 | 精品国产伦一区二区三区观看说明 | 精品国产乱码久久久久久影片 | 91av在线不卡 | 正在播放国产精品 | 国产精品久久久久久久久久久久 | 国产女人精品视频 | 久久狠狠 | 久久久久免费精品国产小说色大师 | 精品欧美一区二区三区久久久 | 99色在线| 国产欧美一区二区三区久久人妖 | 日韩一二区在线 | 九九精品久久久 | www.亚洲视频 | 免费一区二区三区在线视频 | 51ⅴ精品国产91久久久久久 | 亚洲国产成人在线视频 | 国产国产精品久久久久 | 中文精品视频 | 欧美日韩在线视频一区二区 | 欧洲一级黄 | 日韩中文字幕2019 | 在线观看日韩精品视频 | a级在线| 国产精品一区二区三区四区 | 亚洲有码转帖 | 视频一区二区三区在线观看 | 日日天天 | 亚洲电影一区 | 呦呦在线视频 | 国产精品久久久99 | 欧美一区二区三区视频 | 久草视频在线播放 | 久草免费在线视频 | 黄色日批视频 |