Can't disable keys in another process

Started by
4 comments, last by darkchrono4 20 years, 6 months ago
I''m using the screen saver trick to disable the Alt-Tab. It works like its suppose to and I can even switch to other apps with the task bar and Alt-Tab still doesn''t work. But when I try and start another app with CreateProcess Alt-Tab works again. I was using WaitForSingleObject() and INFINITE so that my app waits for the game to finish. I switch the time to 0 and the keys still aren''t disabled. Does it just not work with CreateProcess? Or do I have to do something different?
Advertisement
quote:Somewhere in MSDN; I forget where exactly
Q: How do I disable Ctrl+Alt+Delete and Alt+Tab when running in fullscreen mode?

A: You don't.


If your program isn't a screensaver, it shouldn't need to disable these combinations; if it is, then the screen saver library should do it for you.

[edited by - sbennett on October 12, 2003 7:25:22 AM]
The ALT+TAB hotkey must only be disabled in those currently running processes when you use the screensaver trick... which makes sense - I don''t think the average user would be running too many new processes whilst the screen saver is running.

Not saying it can''t be done- but it will be quite difficult to ''steal'' external apps input focus with all the Windows hotkeys/applications that are designed exactly to do this - not saying it''s impossible, however.

I''d say the easiest way to do this is by hiding the systray window using ::FindWindow() and ShowWindow(... SW_HIDE) so you can''t switch between Windows. If that''s not desirable- maybe Enumerate through all the Windows using EnumWindows(), filling an Array of HWNDs that return TRUE to IsWindowVisible(). Then jump through the Array calling ShowWindow(HWND[Index], SW_HIDE) to hide those Visible Windows...

Not may hotkeys (if any) or applications allow you to switch to invisible windows

hope that helps...
Actually I'm using a combo of the screen saver trick and that keyhook you posted in that other thread (trying to make the app work for Win98 to WinXP). Didn't think about the fact that it wouldn't disable the keys to any process started after it was called. Even the keyhook won't disable them. But if you call CreateProcess and then disable the keys it does work. But I still have a problem. I was trying to disable the keys after I called CreateProcess but before WaitForSingleObject(). My app needs to wait for the child process to complete before doing anything again so I use INFINITE for the time to wait. Doing it this way won't work. But if I set the time to 0 then the keys are disabled in game. Any suggestions?

FindWindow() thats part of the Cwnd class isn't? I'm not using MFC, but what would you pass it to find the systray?

[edited by - darkchrono4 on October 12, 2003 3:21:28 PM]
Why the hell would you want to disable these keys (unless you actually are a screensaver)? I can't think of any legit use thats not stupid and annoying..

And i'm pretty sure that in WinXP that the ctrl-alt-del key press is hardcoded to be uncatchable/uninteruptable. Usability and all that

[edited by - OrangyTang on October 12, 2003 4:02:24 PM]
Two things - Firstly,

quote:Original post by OrangyTang
And i''m pretty sure that in WinXP that the ctrl-alt-del key press is hardcoded to be uncatchable/uninteruptable. Usability and all that


ALT+CTRL+DEL as well as the CTRL+SHIFT+ESC hotkeys can be intercepted in Windows 2000 and XP- using a combination of DLL injection and sucblassing you can set the SAS Window in WINLOGON.EXE to a WinProc() in your injected .DLL file. I''ve got the source from a pass project which I''d happily post if anyone was interested.

Second-

What exactly are ya trying to do, I don''t fully understand? Give us a list of ALL the hotkeys you want to disable.


This topic is closed to new replies.

Advertisement