2

I am interested in getting the Z order for every window currently open by the user. For example, if they had 4 windows on top of each other, I'd like to know (by window title - which I can already get), the order - i.e. which is deepest in the stack and which is at the front of the stack.

Does anyone have an idea as to the code for this? I've been looking at GetTopWindow() and GetNextWindow() but GetTopWindow() seems to return the top window within an application and GetNextWindow() doesn't seem to be referenced in user32.dll (got this from Pinvoke).

Any code ideas/hints would be gratefully received. I'm hoping there is just an integer value which is the Z index of the windows and from that, I can work out the order!

Cheers, Jonathan

Jonathan
  • 147
  • 1
  • 2
  • 10
  • I assume you want windows from outside your application, correct? Otherwise `Application.OpenForms` would be an option. – Chris Barlow Aug 17 '15 at 15:36
  • 1
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx – Hans Passant Aug 17 '15 at 15:38
  • Combination of these two help ? http://stackoverflow.com/questions/3406888/get-location-and-size-of-all-open-windows-using-net-c for all windows & this for z-order : http://stackoverflow.com/questions/825595/how-to-get-the-z-order-in-windows – PaulF Aug 17 '15 at 15:45
  • Yes Chris, all open windows not just from within my application :-). – Jonathan Aug 17 '15 at 15:54

0 Answers0