How to determine whether my application is active (has focus)

前端 未结 5 1279
天命终不由人
天命终不由人 2021-02-05 18:53

Is there a way to tell whether my application is active i.e. any of its windows has .IsActive=true?

I\'m writing messenger app and want it to flash in taskbar when it is

5条回答
  •  旧巷少年郎
    2021-02-05 19:19

    try this, override OnActivated method in your MainForm and do whatever you want

        protected override void OnActivated(EventArgs e)
        {
            // TODO : Implement your code here.
            base.OnActivated(e);
        }
    

    hop this help

提交回复
热议问题