How can I prevent focus stealing in Windows?

后端 未结 1 1264
情书的邮戳
情书的邮戳 2020-12-31 03:57

A quick Google search for solutions to Focus Stealing in Windows reveals two main result categories:

  • People suggesting incomplete solutions involving the Foreg
相关标签:
1条回答
  • 2020-12-31 04:23

    I have one suggestion for how it can be solved, but I cannot implement it completely since I lack the knowledge.

    The focus change between windows have to be instigated by the offending program calling a Windows API function located most probably in shell32 or user32. Some progams, like Adobe Photoshop makes the call multiple times (at least twice) to force itself up on the user when it's starting. The idea is to hook into this API function (if possible) and check where the call originates from. If it's not from explorer.exe (i.e. Alt+Tabbing or clicking an icon on the taskbar), then call should be blocked by said hook.

    0 讨论(0)
提交回复
热议问题