久久久久久久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 ()?環形?)
主站蜘蛛池模板: 国产精品99久久久久久www | 成人三级晚上看 | 四虎影视大全 | 午夜精品久久久久久久久久久久 | 美女久久久久 | 成人三级视频 | a级片在线 | 一级特黄视频 | 超碰在线免费公开 | 欧美久久久久久 | 欧美日韩国产一区 | 在线观看亚洲精品 | 中文字幕免费观看视频 | 色爱综合区 | 色多多视频在线观看 | 色综合久久88色综合天天 | 日本在线天堂 | 国产亚洲视频在线观看 | 久久黄视频 | 欧美狠狠操 | 日本三级一区 | 一区二区三区四区在线视频 | 福利视频午夜 | 黄色高清网站 | 日韩欧美专区 | 久久视频免费 | av超碰在线| 福利小视频 | 亚洲视频网 | 国产精品一区二区在线播放 | 欧美一区二区三区免费 | 日韩一区二区三区在线 | 日韩精品免费在线观看 | 国内av在线 | 人成在线 | 中文字幕在线观看网站 | 在线播放亚洲 | 亚洲国产精品av | 草草在线观看 | 99久久精品国产亚洲 | 麻豆做爰免费观看 |