i found out this reply useful to this post
BTW main culprit is SRS Audio Sandbox
i’m not sure but i guess there’re many methods that an application uses to steal focus, some of them can be prevented by foreground locking (set by ForegroundLockTimeout in winxp+), like any normal app, but some not (like pidgin that uses gtk), and QQ.exe, and SRS Audio Sandbox.
when SRS Audio Sandbox is set as “Technology: Auto Tech” which is default, it will steal focus anyway when it switch Technology. This is annoying for full screen game. Simply switching back is unacceptable.
if you think it’s hard to implement, you may check the following article
with this way, you can hook(redirect/rewrite) api calls in each application
guess (or trace if possible) how an app invoke system api to steal focus. by focusing the window? by min and then restore the window? by setting and then clearing “always on top”?
after you’re sure how an app steal focus, make an option allow us users to set when and how to prevent it
i suggest that only hook (detour) the api if we want to for better compatibility, and unhook when we don’t want it"