Jump to content
Sign in to follow this  
Melque_Lima

how to block "alt+tab"

Recommended Posts

Melque_Lima

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

 

Share this post


Link to post
Share on other sites
Melque_Lima

i tried, doenst work!!:(

#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

 

Share this post


Link to post
Share on other sites
czardas

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 by czardas
  • Like 1

Share this post


Link to post
Share on other sites
Melque_Lima

good idea, i can verify the window title and if its lost focus reappear the window program

  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×