This kind of activity is rather difficult to trap.

There is a tool called process manager from sysInternals (now owned by microsoft). This lets you trap a process that fails to do something correctly. For instance using procmon, I found that one of the processes needed access to a specific file and so some other application was failing. I have never used to check for lost focus, but you might want to take a look into it.