How do I get a handle to the currently focused window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Fuller

    How do I get a handle to the currently focused window

    I would like to get Windows paramaters from the currently in-focus Window in
    C#. What is the best way to do this?


  • Kerem Gümrükcü

    #2
    Re: How do I get a handle to the currently focused window

    Hi Bill,
    >I would like to get Windows paramaters from the currently in-focus Window
    >in C#. What is the best way to do this?
    [DllImport("user 32.dll")]
    static extern IntPtr GetForegroundWi ndow();

    and is the direct opposite:

    [DllImport("user 32.dll")]
    [return: MarshalAs(Unman agedType.Bool)]
    static extern bool SetForegroundWi ndow(IntPtr hWnd);

    Regards

    Kerem

    --
    -----------------------
    Beste Grüsse / Best regards / Votre bien devoue
    Kerem Gümrükcü
    Microsoft Live Space: http://kerem-g.spaces.live.com/
    Latest Open-Source Projects: http://entwicklung.junetz.de
    -----------------------
    "This reply is provided as is, without warranty express or implied."
    "Bill Fuller" <someone@nospam .comschrieb im Newsbeitrag
    news:Oqp7WoaxIH A.3860@TK2MSFTN GP06.phx.gbl...
    >I would like to get Windows paramaters from the currently in-focus Window
    >in C#. What is the best way to do this?
    >

    Comment

    Working...