单击时防止系统任务栏图标窃取焦点 [英] Prevent system tray icon from stealing focus when clicked

查看:64
本文介绍了单击时防止系统任务栏图标窃取焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java编写一个将图标放置在系统任务栏中的应用程序(通过 SWT ).单击此图标后,希望它自动键入一些键(通过机器人类),然后单击(可以在任何窗口中)单击时将焦点放在任何文本字段中.不幸的是,单击系统任务栏图标会使焦点从先前的焦点窗口移开,从而窃取按键.

I am writing an application in Java that places an icon in the system tray (via SWT). When this icon is clicked, I wish to have it automatically type some keys (via the Robot class) into whatever text field is in focus at the time of clicking (could be in any window). Unfortunately, clicking the system tray icon steals the focus away from the previously focused window, thereby stealing the key strokes.

有没有一种方法可以使文本输入到先前聚焦的窗口中?

Is there a way to cause the text to be typed into the previously focused window?

推荐答案

可能不会,至少不容易.之前已讨论过此问题.

Probably not, at least not easily. This issue been discussed before.

这篇关于单击时防止系统任务栏图标窃取焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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