I have a process which opens a form and a tray icon on startup. I want to discover from a c# application what is the handle of the form and tray icon of the exe process above, and what are the handles of all child windows of this exe.
Thanks.
For the window handle it is easiest to use System.Diagnostics.Process
and the MainWindowHandle
property. You don't state how you want to identify the other process but the Process
class has lots of options for that.
Regarding the notification area icon, there is no API for what you are asking. You'd need to either hook the Shell_NotifyIcon
API or modify the other process to cooperate.