I had this issue a long time ago. It may not be the same issue as yours but it was a setting in windows office programs. To find out exactly what is stealing focus from your game, you can use a program like "Windows Focus Logger" which records any program taking focus on your screen. Then you will at least know what causes it. From there, research how to fix it.