Short problem expansion:
The page listing
http://www.csharphelp.com/archives2/archive301.html shows that you can get the window name of the active window. This works but the problem i need is to find the application that caused that window to become active, perhaps by watching an event.. which is similar to keylogging yes.. i know.
Problem Description:
On multiple systems at random times the user will loose focus of ALL windows, like they clicked on the desktop. They have to then click on their app they were in but will continue to loose focus every 10-15 seconds. The freeky part it seems totaly random. The user could be in IE.. could be in notepad.. whatever. It doesn't happen to all the time, so it's hard to test against because it's sparatic and seems random.
Solution Idea...:
I know that by creating a system hook you can track events systemwide, like mouse clicks in any window. You can then allow that event to continue down it's normal path or modify the path it takes. What i'm asking here is... Is there a way to catch the event of a window change prior to it changing so we know where the request came from? Consider the following super anoying popup to get a better idea.
Example:
User is in notepad typing away.. POPUP says "Application ABC wants to change the window focus to DEF window from XYZ. Click YES to allow it or NO to abort the focus change".
OMG that would be anoying... but you get the point of what i'm trying to accomplish so we can figure out what and why they focus is being changed/lost. Oh.. and the solution should be involving C# with dot net 2.0
Start Free Trial