C#: Detecting which application has focus

前端 未结 3 1781
星月不相逢
星月不相逢 2020-11-28 08:27

I\'m looking to create a C# application that changes content according to which application currently has focus. So if the user is using Firefox, my app would know that. Sam

3条回答
  •  抹茶落季
    2020-11-28 08:38

    Take a look at Application.AddMessageFilter, and look for WM_ACTIVATEAPP messages, which will tell you when an app is activated, i.e. receives focus.

提交回复
热议问题