C# SetForegroundWindow not working

前端 未结 2 538
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 05:17

I have restricted my C# windows application to only allow one instance to be running at a time, using this question How to force C# .net app to run only one instance in Wind

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 05:56

    try this...

    System.Threading.Tasks.Task.Factory.StartNew(() => { SetForegroundWindow(this.Handle); });
    

提交回复
热议问题