Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 7: Prevent application from losing focus

I have a self-made fullscreen application for Windows 7 written in C++ which should run for a long time on its own as a public presentation.

Problem is, there are several applications or drivers or Windows itself that steal focus from time to time and/or especially at system startup. Result is: My fullscreen application gets minimimized.

It is very annoying and nearly impossible to always find out which things you have to deactivate to prevent that. Especially because those focus stealing things are sometimes needed, e.g. touchscreen drivers.

What can I do to prevent losing focus?

Or even better: How can I prevent other applications from stealing focus - I remember there once was such a setting in TweakUI for Windows XP.

like image 419
Ole Dittmann Avatar asked Sep 15 '11 12:09

Ole Dittmann


People also ask

How do I keep my window always in focus?

Just press CTRL + SPACE on whatever window you want to stay on top. If it does not match mine, when you right-click, choose Open with and Choose another app.

What is stealing my focus?

In computing, focus stealing is a mode error occurring when a program not in focus (e.g. minimized or operating in background) places a window in the foreground and redirects all keyboard input to that window.

How do I get my apps to stay on top?

To make the active window always on top, press Ctrl + Spacebar (or the keyboard shortcut you assigned). Press the keyboard shortcut again to disable “always on top” for the active window. For script options, right-click on the AutoHotkey icon in the system tray.


1 Answers

Tweak UI does it by changing the SPI_SETFOREGROUNDLOCKTIMEOUT. You can combine this with LockSetForegroundWindow.

like image 59
Raymond Chen Avatar answered Oct 07 '22 02:10

Raymond Chen