如何在 Windows 中创建自定义事件?
这是我希望非常简单的事情,但是在浏览了 Visual Explorer 在线帮助并浏览了各种论坛几个小时后,我仍然不知所措......
基本上,我希望能够创建一个自定义 Windows 事件,它将短整数向量发送给其接收者。我实际上想在 Fortran DLL 中创建事件,但如果我能找到正确的 API 调用来从 C++ 中执行此操作,那么我应该能够解决其余问题。到目前为止,我能找到的所有示例(即使是 C++)都使用 .NET 库,并且我无法从 Fortran 访问它,因此它必须是本机 Windows API。
如果有任何区别,该事件随后将被使用 Qt 编写的 GUI 应用程序捕获为 QEvent。
任何想法将不胜感激。
This is something I'd expect to be quite straightforward, but after a couple of hours browsing Visual Explorer online help and ploughing through various forums, I'm still at a loss...
Basically, I'd like to be able to create a custom Windows event which sends a vector of short integers to its recipient. I'd actually like to create the event inside a Fortran DLL, but if I can find the correct API calls to do it from C++ then I should be able to figure the rest out. All of the examples I've been able to find so far, even for C++, use the .NET library and I cannot access this from Fortran, so it would have to be the native Windows API.
If it makes any difference, the event would subsequently be captured as a QEvent by a GUI application written using Qt.
Any ideas would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 SendMessage 发送消息: http://msdn .microsoft.com/en-us/library/ms644950%28VS.85%29.aspx
然后只需使用任何其他邮件尚未使用的数字即可。您可以使用 RegisterWindowMessage 获取唯一编号: http: //msdn.microsoft.com/en-us/library/ms644947%28VS.85%29.aspx 如果您只需要在自己的应用程序中进行通信,则不需要这个,您可以选择任何数字0x0400 和 0x7FFF 之间。
Use SendMessage to send a message: http://msdn.microsoft.com/en-us/library/ms644950%28VS.85%29.aspx
Then simply use a number that is not yet used by any other message. You can use RegisterWindowMessage to get a unique number: http://msdn.microsoft.com/en-us/library/ms644947%28VS.85%29.aspx If you only need to communicate in your own app, you don't need this and you can pick any number between 0x0400 and 0x7FFF.