KilRoy Posted May 17, 2006 Share Posted May 17, 2006 I am in the middle of a program and I want to block exiting the app with the ESC key. I have put a BlockInput function to block it, but it blocks it globally as long as the app is running. This could be a problem if the user is running another application and needs the ESC key. Is there any way to block the key only for one application and not globally? Or am I looking at it wrong and need to go another route? I've searched the forum, but it seems nobody has tried, or needed, to do this before. Is it possible? Thanks for all your help. KilRoy Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 17, 2006 Moderators Share Posted May 17, 2006 I am in the middle of a program and I want to block exiting the app with the ESC key. I have put a BlockInput function to block it, but it blocks it globally as long as the app is running. This could be a problem if the user is running another application and needs the ESC key. Is there any way to block the key only for one application and not globally? Or am I looking at it wrong and need to go another route? I've searched the forum, but it seems nobody has tried, or needed, to do this before. Is it possible? Thanks for all your help.KilRoyWhy not just disable the X on your GUI (If you have one) and any buttons that normally would make your application exit? I say this, because no matter what hotkey you or BlockInput() you use, Ctrl+Alt+Delete = Task Manager and you app can/would be killed there anyway. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
KilRoy Posted May 17, 2006 Author Share Posted May 17, 2006 I want to be able to exit normally, but not with the ESC key. "Normal" exit would be the X on the GUI, File>Exit, or Exit button. Sorry for not being clear. I'm a systems guy and I hear users whine about everything, so I'm trying to get ahead of them with this one! Thanks. KilRoy Link to comment Share on other sites More sharing options...
GaryFrost Posted May 17, 2006 Share Posted May 17, 2006 Opt("GUICloseOnESC",0) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 17, 2006 Moderators Share Posted May 17, 2006 I want to be able to exit normally, but not with the ESC key. "Normal" exit would be the X on the GUI, File>Exit, or Exit button. Sorry for not being clear. I'm a systems guy and I hear users whine about everything, so I'm trying to get ahead of them with this one! Thanks. KilRoyAhh, you could try to steal the ESC key like:HotKeySet('{ESC}', '_DoNothing') While 1 ;Your script Sleep(100000) WEnd Func _DoNothing() EndFuncSee if that works.. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
KilRoy Posted May 17, 2006 Author Share Posted May 17, 2006 gafrost: That did it! Thanks for opening my eyes! Smoke: I did the hotkey set and it made the ESC not work anywhere while the program was running. I seems the Opt is what I'm looking for. As I said before, this forum is a great learning tool! Thanks for all the help and putting up with dummo questions from people like me! KilRoy Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 17, 2006 Moderators Share Posted May 17, 2006 Lmao... I was just testing what I did when I re-read your post and realized it wasn't going to work. Then I decided to look at the Opt's in the help file, and found what Gary just posted... ahh well, that's what I get for staying up all night, glad he was here to help ya out! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jvanegmond Posted May 17, 2006 Share Posted May 17, 2006 (edited) gafrost: That did it! Thanks for opening my eyes! Smoke: I did the hotkey set and it made the ESC not work anywhere while the program was running. I seems the Opt is what I'm looking for. As I said before, this forum is a great learning tool! Thanks for all the help and putting up with dummo questions from people like me! KilRoy Here's another option to steal it from any window. * Untested While 1 If WinActive("Window Title") Then Hotkeyset("{ESC}", "Nothing") Else Hotkeyset("{ESC}") EndIf Sleep(100) Wend [edit] Added sleep Edited May 17, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now