Sorry for necroing old thread, but this page is first result when Googling for "Windows 10 window loses focus" or similar, which is an annoying issue I was having and have now resolved. I created a user account on this site just to post this solution, so that others might benefit as well.
I took some time to search Event Viewer for recurring events that happened immediately when the window focus was lost. I didn't find any under Applications and Service Logs. I started looking under Windows Logs, and immediately noticed recurring events under Application. There were two recurring events related to esif_assist_64.exe. I Googled that .exe file and found http://www.file.net/process/esif_assist_64.exe.html which mentions this:
"The process known as Intel® Dynamic Platform and Thermal Framework Utility Application appears to belong to software Intel® Dynamic Platform and Thermal Framework Utility Application by Intel (www.intel.com).
Description: Esif_assist_64.exe is not essential for Windows and will often cause problems. The file esif_assist_64.exe is located in a subfolder of C:\Windows. Known file sizes on Windows 10/8/7/XP are 257,192 bytes (76% of all occurrences), 257,152 bytes, 255,744 bytes or 257,528 bytes. http://www.file.net/process/esif_assist_64.exe.html
The program is not visible. It is not a Windows system file. The file is digitally signed. Therefore the technical security rating is 75% dangerous."
So I searched my Services for Intel but didn't find anything about the Dynamic Platform blah blah. So I searched Services for "esif" and found the "ESIF Upper Framework Service" running, so I tried stopping it, and I haven't had the focus issue occur since! I also disabled startup of the Service as well. To disable startup of a Service, open Services (hit Start menu > type "services" > Enter to open the app that should show up), find the Service you want to disable, double-click to open its Properties window, and change the Startup type drop-down to "Disabled". Now it shouldn't startup when Windows starts.
So the simple story is to stop and disable startup for the esifsvc service a.k.a. "ESIF Upper Framework Service". However if that doesn't solve the issue for you, try my methods and search the Event Viewer for logs/errors/anything that occurs exactly when the issue happens. At one point for me, the focus issue would occur every 10-30 seconds (extremely annoying), so I would open an area of the Event Logs, wait for the focus issue to occur, then immediately hit refresh and see if new logs appeared. Once you find logs that pop every time the issue occurs, you can Google from there (in my case "esif_assist_64.exe" was the key). But all-in-all it appears this window focus issue is usually related to a single Service crashing over and over or something similar, so lean toward finding a Service that you can try stopping and if the issue goes away, you've found your root cause. just stop it and disable startup and you should be good to go.
FYI I used a throw-away email to register this account just to leave this comment. Sorry to admins but I didn't want another forums account but I really wanted to leave this comment for others to find this solution. Hope it helped someone else save a ton of time that I wasted.
Also, side note; Man, the amount of unnecessary processes jammed into Windows 10...most bloated OS yet, geez.