Find the window that currently has focus

  • Thread starter Thread starter pigeonrandle
  • Start date Start date
Hi James,

Windows API:
[DllImport("user32.dll")]
static extern IntPtr GetActiveWindow();

or .NET:
Form activeForm=Form.ActiveForm;

HTH
Marcin

pigeonrandle napisa³(a):
 
All,

Thanks for the swift replies. When i said window, i meant
buttons/textboxes included...

Cheers,
James.
 
Hi,

Check out the following link, which provides some information about how (and
if) it's possible:

GetFocus Function
http://msdn2.microsoft.com/en-us/library/ms646294.aspx

--
Dave Sexton
http://davesexton.com/blog

pigeonrandle said:
All,

Thanks for the swift replies. When i said window, i meant
buttons/textboxes included...

Cheers,
James.

Michael said:
Hello pigeonrandle,

http://www.pinvoke.net/default.aspx/user32/GetActiveWindow.html

---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and
we
miss it, but that it is too low and we reach it" (c) Michelangelo

p> Hi,
p> Is there an API function that can do this?
p> Cheers,
p> James.
 

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