Bringing Window to the Front in C# using Win32 API

前端 未结 6 1700
生来不讨喜
生来不讨喜 2020-12-09 01:46

I am writing an application that needs to bring window of an external app to the foreground, and not necessarily steal focus (there is a setting the user can toggle to steal

6条回答
  •  無奈伤痛
    2020-12-09 02:22

    Have you tried using SetWindowPos. This is the canonical function for moving, resizing and setting z-order in Windows. There is a SWP_NOACTIVATE flag you can use. Look at http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx. I have not tried this on a window belonging to another process, but it is probably worth a try.

提交回复
热议问题