How to apply SetWindowDisplayAffinity to other applications’ windows?

  agent, c++, dll-injection, winapi, windows

I understood the explanation of the purpose of SetWindowDisplayAffinity().

This answer is clear and understandable. The code we will run for another application will give us an access denied error.

My main problem: I don’t want to show open applications like Notepad, Chrome, Visual Studio, etc. How can I do that? Do I need to inject a DLL into these applications? If so, could you guide me or suggest a method?

How can I run the SetWindowDisplayAffinity() function in one of the applications in this screenshot?


Source: Windows Questions