knowing which application has focus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Justin Creasy

    #1

    knowing which application has focus

    I am creating a program to monitor the open applications on a desktop
    (kinda like "Applicatio ns" tab in the Windows Task Manager). You can
    access all of the information you can see in the Task Manager, but I
    want to add some functionality.

    The main thing I want to be able to do is know which of the
    applications currently has focus in Windows. I haven't found anything
    in the Process class in .NET. Can anyone think of a way to know which
    application currently has focus?

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: knowing which application has focus

    Justin,

    You should be able to call the GetForegroundWi ndow API function through
    the P/Invoke layer to determine which window is in the foreground (and
    ultimately, what has the focus).

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Justin Creasy" <justin.creasy@ gmail.com> wrote in message
    news:1135215043 .007212.284840@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    >I am creating a program to monitor the open applications on a desktop
    > (kinda like "Applicatio ns" tab in the Windows Task Manager). You can
    > access all of the information you can see in the Task Manager, but I
    > want to add some functionality.
    >
    > The main thing I want to be able to do is know which of the
    > applications currently has focus in Windows. I haven't found anything
    > in the Process class in .NET. Can anyone think of a way to know which
    > application currently has focus?
    >[/color]


    Comment

    Working...