如何在系统托盘中找到图标的位置 [英] How to find the location of the icon in the system tray
问题描述
我有一个出现在系统托盘中的 NotifyIcon 控件.如何在屏幕上找到图标的位置 (x, y)?
I have a NotifyIcon control that appears in the system tray. How can I find the location (x, y) of the icon on the screen?
谢谢
推荐答案
你不能.获取系统托盘的窗口句柄并不难,GetClassName() 返回ToolbarWindow32",即标准TOOLBAR 公共控件的类名.请注意 64 位操作系统有两个.然后你可以像 TB_GETBUTTONINFO 一样向它发送消息.主要的问题是你不知道选择哪个按钮 ID,返回的信息不包括按钮位置.
You can't. It isn't hard to get the window handle for the system tray, GetClassName() returns "ToolbarWindow32", the class name of the standard TOOLBAR common control. Beware that a 64-bit OS has two of them. Then you can send messages to it like TB_GETBUTTONINFO. Chief hang-ups are that you won't know what button ID to choose and the returned info does not include the button position.
哪个更好,按钮可以移动而您无法锁定它们.
Which is for the better, buttons move around without you being able to lock them.
这篇关于如何在系统托盘中找到图标的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!