Search code examples
c#topmost

TopMost for other apps


Is there a possibility to set top most e.g of Notepad.exe to true from my App?

Currently I am developing a personal overlay for my desktop. When I open a new Window it should not be behind my full-screen application.


Solution

  • Yes, so long as you can find the HWND of the target window, you would set the WS_EX_TOPMOST extended window style using a call to SetWindowLongPtr. Note this change would persist after your program exits unless you change it back.