Subscribe Now: Feed Icon

Sunday, December 11, 2011

Active Window Loses Focus problem (Full Screen minimizes)

For the past several years I have been having a problem with my home computer (Windows XP), the problem is not so severe just annoying (though I guess for some people it will be much more severe). My problem? from time to time the application I work on losses it’s focus for a second and then either:

a. gets it back (when it’s in windowed state) 

b. another application gets the focus (when it’s full screen applications).

My solution to the problem was using only windowed applications but it is too annoying when watching movies or sometimes impossible when playing games.

From time to time I would search the web for solutions and find forums that advise people to open Task Manager (or other similar applications) and just see what application is stealing the focus – the problem is you need to be fairly fast to catch the bugger (especially when games and movies demand your full attention). Other solutions were with specific applications that caused the problem like AVG anti virus (in one of its old versions). I have tried formatting the computer but the problem returned (meaning it must be some application I always use).

So I have decided to fix (or at least find the problematic application) myself. I first found a windows function that partially does what I wanted – GetForegroundWindow, then searching for it with C# I found a solution at StackOverflow site a bunch of invoke methods that return the current focused window information, all that was left was wrapping it in a console application and using it.

In the end running the little app at home found the problem:

27/11/2011 20:22:10:C:\WINDOWS\System32\rasautou.exe -> Connecting Cables012...

For the past several years my computer has been the dial up computer for the internet. Cables012 is that connection. Thinking to solve connection problems I enabled “Establish a dial-up connection whenever a computer on my network attempts to access the Internet”:


I thought to myself that this option will just reconnect to the internet when the connection is down, well it does that and also steals the windows focus whenever it feels like and at exactly midnight it also activate what I like to call “Blinking Window Mode” when at least one window will appear in the general top left area of the screen and disappear before you can read what it says…

Well the fix was easy enough just uncheck this option and restart the connection. This whole thing was a surprise since I was sure I had some kind of funky spyware app installed which caused all of this…

I have added the source code for this little app to my Codeplex project, and also a release exec (for the non programmers who reach this site).


Keywords: Windows, Full Screen, Focus

IceRocket Tags: ,,