the implementation of thread input processing has been moved around a few times in different versions of windows, but the logic is basically the same as it has always been. With a few important exceptions, each thread that wants to show windows, runs a loop called a message pump and dispatches them - performing default or custom actions accordingly. User input triggers the system to add messages to the queue. As do functions like SetFocus.
It is important to note that the focus is not a system wide concept at this level. It is the focus among all of the windows owned by this thread. And yes, controls like text or combo boxes are windows too.
Its quite a broad question. You can find out a lot by looking at DefWindowProc. If you have a more specific question, we can probably provide a better answer
Let me explain myself better, My final goal is to manipulate a thread to think one of its windows is in focus even tho it's not.
In Windows 10 I was able to do it by hooking NtUserGetThreadState but in Windows 11 GetFocus is no longer calling NtUserGetThreadState but instead reads the focused hwnd from the TEB, so that solution isn't possible anymore.
so instead of hooking NtUserGetThreadState, I'm looking for the function that modifies that TEB value and prevents it from writing anything else than a specific window that I wish the thread to keep thinking it's in focus
I hope this is more clear and easy to understand.
Thanks in advanced!!!
If you want the focus to be on some other window, why don't you just set it to that window? If you only want the focus to be modified some of the time, then detour GetFocus?
All of this presumes that you have a legitimate reason for mucking with the focus