Information on which application has focus

  • Thread starter Thread starter sosh
  • Start date Start date
S

sosh

Hi,

Bit of a newbie question, but is it possible from the .net framework,
to gather information on which application (managed or otherwise)
currently has GUI focus?

Thanks.
 
Josip Habjan said:
Public Declare Function GetActiveWindow Lib "user32" Alias
"GetActiveWindow" () As Long

Note that 'Long' is a 64-bit data type in .NET. Thus the return value
should be 'As IntPtr' and not 'As Long'. In addition to that you can drop
the alias in this case ;-).
 
Back
Top