get the foreground window in my application

  • Thread starter Thread starter CBanu [IXIA]
  • Start date Start date
C

CBanu [IXIA]

I'm trying to get the window that is currently on top in my
application, even if I'm currently working in another application.
Something like the P/Invoke call GetForegroundWindow(), but I want it
to operate only on my application's forms. I've also tried using
Application.OpenForms[], but I don't know how to tell which one is on
top of the others.

Any ideas?

Thanks in advance,
Cosmin
 
I'm trying to get the window that is currently on top in my
application, even if I'm currently working in another application.
Something like the P/Invoke call GetForegroundWindow(), but I want it
to operate only on my application's forms. I've also tried using
Application.OpenForms[], but I don't know how to tell which one is on
top of the others.

Probably you want is System.Windows.Forms.Form.ActiveForm. This form is not
necessarily the form that is 'on top' - see also the TopMost form property.
It is possible for a form to be topmost but not be the active form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top