PDA

View Full Version : disable alt+tab



ahmdsd_ostora
10th July 2010, 13:53
I want to disable the alt+tab combination, that's, the user can't bring another application on the top instead of my application, so my application remains on the top.

how to do that?

wysota
10th July 2010, 14:14
Wouldn't it be better to ask the following question?

"How do I make my application stay on top?"

Alt+tab is not the only way to switch applications, you know...

http://catb.org/esr/faqs/smart-questions.html

ahmdsd_ostora
10th July 2010, 14:36
it's ok, how to make my application stay on top ?

(btw. I asked the specific question to simplify my problem to gather as much as answers it can, coz a few people tried to make apps always on top, but sure, more people tried to listen to and disable events, which isn't necessarily (alt+tab) )

wysota
10th July 2010, 16:14
it's ok, how to make my application stay on top ?

Set a Qt::WindowStaysOnTopHint flag on your window. Setting the window to full screen mode might be helpful too.


(btw. I asked the specific question to simplify my problem to gather as much as answers it can, coz a few people tried to make apps always on top, but sure, more people tried to listen to and disable events, which isn't necessarily (alt+tab) )
Asking about alt+tab does not simplify your problem. The fact that you know a solution that does "more or less what you want" doesn't make your actual problem any simpler.

SixDegrees
10th July 2010, 17:17
Note, also, that giving a hint for a window to stay on top won't always work; such behavior is dependent on the underlying window manager, and not all of them support such things.

Note too that an application that can't be gotten out of the way has the potential to be incredibly annoying to many users. Think very hard about whether you want to pursue this approach; it runs counter to most UI guidelines.

squidge
10th July 2010, 18:31
Secondly, on Windows XP and above, pressing the "Windows Key" will automatically remove your applications "stay on top" flag and allow access to the task bar and start menu. On Windows 7 you can also forcibly resize any application to stop it hogging the entire desktop by using the task bar.

wysota
10th July 2010, 18:34
In other words, install an X11 system and run your app without a window manager ;) And seriously what we are looking for here is 'kiosk mode'.

squidge
10th July 2010, 19:33
In another topic where he asks more or less the same question (topic:"Lock screen") his target OS is Windows, so I don't think he wants to install X11 :)

wysota
10th July 2010, 20:28
If he wants to annex the whole system for his app, then what difference does the OS make? :)

squidge
10th July 2010, 22:19
How he's going, he's going to need a system level driver to hook into the input stream and prevent certain events from reaching the OS, so he'll need to decide on an OS first. Unless of course he decides to rewrite the BIOS and stop everything there :)

wysota
10th July 2010, 22:49
And certainly the whole topic is out of scope of this forum...

squidge
10th July 2010, 23:22
Indeed. I've tried to push him in the right direction, but maybe he doesn't like doing research.

wysota
10th July 2010, 23:22
So I've seen...

ahmdsd_ostora
11th July 2010, 07:26
mmm, so .. alot of discussions here :)
and the result that you all agreed is that I am fool :):)

ok, let's ask a shorter (encapsulated) question:
I want a method that pushes my application on the top of all applications when it's called any time .. just it, and I will use it to achieve my goal by quick periodical calls.

wysota
11th July 2010, 08:27
If you do that, you risk that the first thing your users will do after launching your program will be to quit and uninstall it. Especially that you'll be wasting CPU power (besides the app being annoying). What is the point of what you are doing?

ahmdsd_ostora
11th July 2010, 08:31
Note too that an application that can't be gotten out of the way has the potential to be incredibly annoying to many users. Think very hard about whether you want to pursue this approach; it runs counter to most UI guidelines.

The user will be pleased if this feature succeeds. It's a lock screen, friend.




Set a Qt::WindowStaysOnTopHint flag on your window. Setting the window to full screen mode might be helpful too.


This flag is working unless the OS forced the application to be behind. It cannot be used here.



Indeed. I've tried to push him in the right direction, but maybe he doesn't like doing research.


1- immitating a screen saver will not allow me to add a password edit field, I found an action that runs a secured screen saver but it doesn't work on xp .
2- This requires admin access.
3- will break the portabily even if my current target is Windows.

ahmdsd_ostora
11th July 2010, 08:33
If you do that, you risk that the first thing your users will do after launching your program will be to quit and uninstall it. Especially that you'll be wasting CPU power (besides the app being annoying). What is the point of what you are doing?

It's a lock screen that prevents access to the PC at certain times, mainly targets kids.
btw. the kid will not be able to exit the application. :)

wysota
11th July 2010, 08:42
the kid will not be able to exit the application. :)
What if he presses Ctl+Alt+Del and kills the application from within the task manager? Or... reboots the computer?

ahmdsd_ostora
11th July 2010, 08:55
What if he presses Ctl+Alt+Del and kills the application from within the task manager? Or... reboots the computer?

1- if he clicked Ctl+Alt+Del , my application will quickly get over the task manager, and prevents him from even seeing the processes list,
2- if he reboots the computer, my application should run on the start-up and check the time, and lock the screen if it's not an allowed time.

wysota
11th July 2010, 09:01
It's all an arcade, I'm sure the kid will be able to find a way to use the task manager. As for the second step each autostart entry can be disabled prior to your application launching. Not forgetting that it can simply be killed before the deadline comes and the screen is "locked". Why can't you use regular parental control facilities (be it built into the system or provided by a 3rd party)?

ahmdsd_ostora
11th July 2010, 09:10
hey, I am just a developer and should implement what the customer needs. :)
and about workarounds to disable the program, if the kid is able to win this hard challenge, he doesn't need any control then. Any one who can disable it, this feature isn't for him for sure.

wysota
11th July 2010, 09:17
hey, I am just a developer and should implement what the customer needs. :)
Should be: ... what the customer thinks he needs. Wasting 100% CPU power just to QWidget::raise() a window several times per seconds is just plain silly. Windows has locking facilities built in, it's just a matter of triggering them at a specific time, no need to reinvent the wheel.

squidge
11th July 2010, 09:21
1- if he clicked Ctl+Alt+Del , my application will quickly get over the task manager, and prevents him from even seeing the processes list,
2- if he reboots the computer, my application should run on the start-up and check the time, and lock the screen if it's not an allowed time.

Unless of course he uses the shortcut key to disable all startup programs whilst he logs in :)

There are much better applications out there for what you are trying to do. These apps have the kids login as normal and if it isn't the allowed time yet the login simply fails and they are left at the windows login screen. If they are logged in and the time is near, they get a warning message. When the end time triggers, they get logged out and can not log back in. Of course, different kids (or parents) with different usernames and passwords can have completely different (or no) restrictions.

You can't really do a decent job of this and be portable. You need to be OS-specific. Windows can be tough, but Linux will be tougher (even in a completely frozen X windows environment, you can still drop to a shell and kill everything).

ahmdsd_ostora
11th July 2010, 09:36
I am sure that Windows has locking facilities, the question is, How to use these facilities?



There are much better applications out there for what you are trying to do. These apps have the kids login as normal and if it isn't the allowed time yet the login simply fails and they are left at the windows login screen. If they are logged in and the time is near, they get a warning message. When the end time triggers, they get logged out and can not log back in. Of course, different kids (or parents) with different usernames and passwords can have completely different (or no) restrictions.

this will be perfect, but HOW

wysota
11th July 2010, 09:40
Windows can be tough, but Linux will be tougher (even in a completely frozen X windows environment, you can still drop to a shell and kill everything).
It's possible to deny login to the console (at specific hours or not) using PAM. There are probably ways to get around that but this specific thing is not a problem (of course you can schedule a cronjob in advance that will kill the annoying app). On Windows it should be much easier as parental control is embedded directly in the system.