1

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.

gln
  • 1,011
  • 5
  • 31
  • 61
  • Not a perfect duplicate, but in the same spirit: http://stackoverflow.com/questions/3019066/get-all-window-handles-for-a-process – Doc Brown May 31 '11 at 06:24

1 Answers1

2

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490