如何在QT5中没有截断的情况下获取Windows_x64消息的结果?

发布于 2025-01-22 20:38:39 字数 1925 浏览 3 评论 0 原文

在QT5中,处理本机Windows消息的函数是:

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

文档说第三个参数表示 在Windows上。在qt6中,参数被更改为 ://doc.qt.io/qt-5/qtglobal.html#qintptr-typedef“ rel =“ nofollow noreferrer”> qintptr

bool QWidget::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)

现在您可以正确通过64-bit <代码>使用64位 qintptr 使用lresult 。但是应该在Windows X64上使用 32位 long 在qt5中?

我有一个自定义 messageHandler ,它使用其 lresult 返回各种8字节指针,因此call *结果= sendmessage(...)本地Event 存储截断的结果。

In Qt5, the function for processing native Windows messages is:

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

and the documentation says, that the third parameter means LRESULT on Windows. In Qt6, the parameter was changed to qintptr:

bool QWidget::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)

Now you can properly pass 64-bit LRESULT using 64-bit qintptr. But what should be done on Windows x64 with 32-bit long in Qt5?

I have a custom MessageHandler which returns various 8-byte pointers using its LRESULT, so the call *result = SendMessage(...) from nativeEvent stores the truncated result.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洋洋洒洒 2025-01-29 20:38:39

Windows X64应该做什么?”

不使用QT5。

嗯,您可以在大多数程序中使用QT5,但是您不能将QT使用来处理此特定消息。您可以做的是子类别(请参阅窗口) 一样通过QT窗口过程进行处理。

winapi函数 setWindowsubClass )并写下您自己的窗口过程,

  • 该过程仅处理该消息,同时允许所有其余的人像往常 href =“ https://learn.microsoft.com/en-us/windows/windows/win32/controls/subclassing-overview-subclassing-controls-controls-usis-comctl32dll32dll-version-6” Learh.microsoft.com/en-us/windows/win32/controls/subclassing-overview-subclassing-controls-controls-using-comctl32dll32dll32dll-version-6

当它谈论子分类窗口(控制)时,对于顶级窗口而言,工作正常。

what should be done on Windows x64?"

Don't use Qt5.

Well, you can use Qt5 for most of your program, but you can't use Qt for processing this particular message. What you can do is subclass the window (see WinAPI function SetWindowSubclass) and write your own window procedure which processes only that single message, while allowing all the rest to process through the Qt window procedure as usual.

Here is an official Microsoft tutorial on subclassing:

While it talks about subclassing a child window (control), the same technique works fine for top-level windows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文