简体   繁体   English

如何检测对Windows系统托盘的更改?

[英]How to detect changes to the Windows system tray?

I've got a Windows 7 VM which runs my mandatory corporate communication systems (Lync and Outlook). 我有一个运行我的强制性公司通信系统(Lync和Outlook)的Windows 7 VM。 What I'd like to do is run a process on this Windows machine which monitors the system tray and sends notifications to my host machine (Xubuntu 13.04) so I'm informed when I get an email or IM (I've already tried seamless RDP to do this but it's an ineffective solution). 我想做的是在此Windows计算机上运行一个进程,该进程监视系统托盘并将通知发送到我的主机(Xubuntu 13.04),以便在收到电子邮件或IM时得到通知(我已经尝试了无缝操作RDP可以做到这一点,但这是无效的解决方案)。

Anything Linux or network oriented I can handle with relative ease, what I do not know how to do is to how to query the state of the Windows system tray (or attach an event listener for state changes). 我可以相对轻松地处理Linux或面向网络的任何事情,我不知道该怎么做是如何查询Windows系统任务栏的状态(或为状态更改附加事件侦听器)。 I'm comfortable with C++ and Python but I'll give any viable solution a go. 我对C ++和Python感到很满意,但是我会给出所有可行的解决方案。

Detailed state information would be preferable but at the very minimum I need to be able to detect changes in the number of icons in the tray. 详细的状态信息将是可取的,但最起码​​,我需要能够检测出托盘中图标数量的变化。

On Windows, if you install Visual Studio, among Visual Studio Tools there is a useful tool, named "Spy++", basically it's a tool that shows you all the windows and gives ability to see what messages particular window receives. 在Windows上,如果安装了Visual Studio,则在Visual Studio工具中有一个有用的工具,名为“ Spy ++”,基本上,它是一个工具,可以显示所有窗口并提供查看特定窗口收到的消息的功能。

在此处输入图片说明

Using this tool, you can see that whole panel, that contains "Start button", shortcuts, tray, clock, etc. is "Shell_TrayWnd". 使用此工具,您可以看到整个面板(包含“开始按钮”,快捷方式,任务栏,时钟等)是“ Shell_TrayWnd”。 You can use "Find" menu to search for a particular window just dragging an "aim" on any window. 您可以使用“查找”菜单来搜索特定窗口,只需在任何窗口上拖动“目标”即可。

The tray window itself is "SysPager" (000100D2 on attached image), you can log messages for this window and see what type of message this window receives when you receive mail in Outlook. 任务栏窗口本身是“ SysPager”(附件图像上为000100D2),您可以在该窗口中记录消息,并查看在Outlook中接收邮件时该窗口接收的消息类型。

After that you can write a code that will listen to all messages that this window receives, and basing on what you have seen in "Spy++" determine what happened. 之后,您可以编写代码来侦听此窗口接收的所有消息,并根据在“ Spy ++”中看到的内容确定发生了什么。

This is just for start. 这只是开始。 Writing a code that will get a window handle and listen to messages that window receives is another part, but I think it's already covered at MSDN or even at StackOverflow. 编写将获取窗口句柄并收听窗口接收到的消息的代码是另一部分,但是我认为MSDN甚至StackOverflow都已经介绍了该代码。 Searching for a particular window handle is done by FindWindowEx function and in order to listen to message you have to set a "hook" that is done by SetWindowsHookEx function. 搜索特定的窗口句柄是由FindWindowEx函数完成的,为了收听消息,您必须设置由SetWindowsHookEx函数完成的“挂钩”。 Hooking is described pretty good on MSDN. 在MSDN上对挂钩的描述非常好。

may be you need Outlook inspector ( http://msdn.microsoft.com/en-us/library/office/ff869356(v=office.15).aspx ). 可能是您需要Outlook检查器( http://msdn.microsoft.com/zh-cn/library/office/ff869356(v=office.15).aspx )。 As i understand it helps to watch events outlook processes. 据我了解,这有助于观看事件展望过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Windows中创建任务栏(系统托盘)应用程序 - How to make a taskbar (system tray) application in Windows 如何在Windows系统任务栏提示中显示与号? - How to display an ampersand in a Windows system tray prompt? MFC / WinApi:如何检测Windows 10中的系统语言何时更改? - MFC/WinApi: How detect when system language changes in windows 10? 如何获取显示隐藏的系统任务栏图标的窗口的隐藏窗口句柄 - How to get hidden windows handle of the windows that show hidden system tray icons 如何在Windows中编写一个最小化到系统托盘的控制台应用程序? - How do I write a console application in Windows that would minimize to the system tray? 从非托管C程序在Windows系统托盘图标上写入文本时如何保持透明度 - How to maintain transparency when writing text on a Windows System Tray icon from unmanaged C program 如何检测Windows服务中的系统空闲? - How to detect system idle in windows service? macOS “Big Sur” 检测深色菜单栏/系统托盘 - macOS “Big Sur” Detect dark menu-bar/system tray 如何在Linux中编写系统托盘的应用程序 - How to write an application for the system tray in Linux C ++ Windows系统托盘不会显示消息 - C++ Windows System Tray wont display message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM