2

Im looking for a way to get all handles in a specified window,
of every button and everything. I tried with EnumDesktopWindows but it doesnt enum every handle, only the window handles.

alexx
  • 21
  • 1

2 Answers2

2
  public Form1()
  {
     InitializeComponent();
     List<IntPtr> handles = GetHandles(this.Controls);
  }

  public List<IntPtr> GetHandles(Control.ControlCollection inControls)
  {
     List<IntPtr> list_of_handles = new List<IntPtr>();
     if(inControls != null)
     {
        foreach (Control c in inControls)
        {
           list_of_handles.Add(c.Handle);
           list_of_handles.AddRange(GetHandles(c.Controls));
        }
     }
     return list_of_handles;
  }
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
0

I think he is trying to get the handles of another window, not his window

alex
  • 1,228
  • 1
  • 16
  • 38