Do you have your touchpad active? It could be that when your hand touches parts of the touchpad, this could be happening. I can use touchpads when I have to, but normally I disable it and use a mouse. Personally I think the touchpad is a masochistic device designed by evil demons.
For the past six months or so I've had the problem of having my active window deselect itself many time during a session...as often as every ten seconds or so. I have Windows 7 Ultimate 64 bit installed on a Dell Xps 15z-i7.
I have read most of the windows forum suggestions on this topic, and none have work for more than a week or two. I have run ARO software checks and Advanced System Care 6 Pro. No help.
I updated my Nvidia software...no help.