Melque_Lima Posted October 27, 2016 Posted October 27, 2016 hi every one, fine? i want that anyone gets out from my program before closing it, and i need to block the function "alt+tab" that navigates through the windows. i tried to create a hotkey, but it does not worked like bellow: HotKeySet("!{Tab}", "Nothing") While 1 sleep(50) EndIf Func Nothing() ; EndFunc
czardas Posted October 27, 2016 Posted October 27, 2016 It might work with an accelerator. Check out GUISetAccelerators in the help file. operator64 ArrayWorkshop
Melque_Lima Posted October 27, 2016 Author Posted October 27, 2016 i tried, doenst work!! expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("Custom MsgBox", 225, 80) GUICtrlCreateLabel("Please select a button.", 10, 10) Local $idYes = GUICtrlCreateButton("Yes", 10, 50, 65, 25) Local $idNo = GUICtrlCreateButton("No", 80, 50, 65, 25) Local $idExit = GUICtrlCreateButton("Exit", 150, 50, 65, 25) ; Set GUIAccelerators for the button controlIDs, these being Ctrl + y and Ctrl + n Local $aAccelKeys[2][2] = [["!{Tab}", $idYes]] GUISetAccelerators($aAccelKeys) GUISetState(@SW_SHOW) ; Display the GUI. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idYes MsgBox($MB_SYSTEMMODAL, "You selected", "Yes") ; Displays if the button was selected or the hotkey combination Ctrl + y was pressed. Case $idNo MsgBox($MB_SYSTEMMODAL, "You selected", "No") ; Displays if the button was selected or the hotkey combination Ctrl + n was pressed. Case $idExit MsgBox($MB_SYSTEMMODAL, "You selected", "Exit") ExitLoop EndSwitch WEnd GUIDelete() ; Delete the GUI. EndFunc ;==>Example
czardas Posted October 27, 2016 Posted October 27, 2016 Yeah, I see that. It was worth a try. operator64 ArrayWorkshop
czardas Posted October 27, 2016 Posted October 27, 2016 (edited) Why is Alt+Tab an issue? Perhaps you can redesign your program/features. Maybe force the window to always be topmost, so if someone presses Alt+Tab, the window should automatically reappear. You could add a message with instructions telling the user what to do when this happens. Edited October 27, 2016 by czardas Melque_Lima 1 operator64 ArrayWorkshop
Melque_Lima Posted October 27, 2016 Author Posted October 27, 2016 good idea, i can verify the window title and if its lost focus reappear the window program czardas 1
czardas Posted October 27, 2016 Posted October 27, 2016 Good luck. Any problems with it, then post a question in General Help and Support. operator64 ArrayWorkshop
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