How to find the location of the icon in the system tray

前端 未结 3 954
感情败类
感情败类 2020-12-20 23:28

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?

Thanks

3条回答
  •  -上瘾入骨i
    2020-12-21 00:09

    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.

提交回复
热议问题