Also see
WM_ACTIVATE's lParam
http://msdn.microsoft.com/
and
WM_ACTIVATEAPP's lParam for thread info
http://msdn.microsoft.com/
Main Topics
Browse All TopicsShort problem expansion:
The page listing http://www.csharphelp.com/
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
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Also see
WM_ACTIVATE's lParam
http://msdn.microsoft.com/
and
WM_ACTIVATEAPP's lParam for thread info
http://msdn.microsoft.com/
wm_activateapp sure looks like what i'm looking for! Sadly i'm not wrapping my noggin around how to write this as a system hook instead of just the active app. I see that it works two ways but basicly i need to write something that watches everything, not just the app i write, as the problem exists in one of the several other programs which i don't have the source to.
Tell yah what though.. i've been workin on this for a while now and just didn't know how to ask what i was looking for. This is a great starting point so i'm going to mark it as accepted. There will probably be a follow up question on how to write a system level hook to catch all events not just the ones to the application itself.
great answer.. WONDERFULL reply time omg!
Business Accounts
Answer for Membership
by: peetmPosted on 2008-09-18 at 08:47:26ID: 22512257
See WM_SETFOCUS's wParam value.