Qt:如何将事件发送到操作/窗口系统? [英] Qt: How to send an event to the operating/window system?

查看:993
本文介绍了Qt:如何将事件发送到操作/窗口系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个Qt应用程序中创建一个事件,它可以由一个单独的Qt应用程序同时运行。正常的sendevent函数需要你命名将接收它的对象,但我不能使用它,我想它像一个键盘按事件,通过任何打开的程序在操作系统过滤。有谁知道如何做到这一点?感谢

解决方案

查看 Qt中的进程间通信。最跨平台友好的方式是使用套接字。



共享内存也是一种选择,但对于事件,我建议使用一个套接字,然后您可以在接收端连接插槽来处理它像一个本地事件。 / p>

编辑:对不起,我想我错过了真正的点,当我阅读其他答案,你想做一个像记录笔记任何地方的键盘记录器。不确定那个。


I want to create an event in one Qt application that can be picked up by a seperate Qt application running at the same time. The normal sendevent function requires you to name the object which will receive it but I can't use that, I want it to be like a keyboard press event which filters through any open programs in the OS. Does anyone know how to do that? thanks

解决方案

Take a look at Inter-Process Communication in Qt. The most cross-platform friendly way is to use a socket.

Shared memory is also an option, but for events I would recommend a socket that you can then attach slots to on the receiving side to handle it like a local event.

Edit: Sorry I think i missed the real point when I read the other answer, you want to make something like a key-logger that records strokes anywhere. Not sure about that one.

这篇关于Qt:如何将事件发送到操作/窗口系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆