如何在QT5中没有截断的情况下获取Windows_x64消息的结果?
在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
存储截断的结果。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不使用QT5。
嗯,您可以在大多数程序中使用QT5,但是您不能将QT使用来处理此特定消息。您可以做的是子类别(请参阅窗口) 一样通过QT窗口过程进行处理。
winapi函数
setWindowsubClass
)并写下您自己的窗口过程,当它谈论子分类窗口(控制)时,对于顶级窗口而言,工作正常。
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.