Msgbox to block user input

Get help with using AutoHotkey and its commands and hotkeys
Pepineros
Posts: 15
Joined: 16 Apr 2018, 17:26
Location: Ireland

Msgbox to block user input

16 Dec 2018, 16:24

Hi all,

I wasn't able to find an answer to this question, possibly because I'm not sure how to ask it in a way Google understands.

Many applications can throw errors that prevent the user from interacting with the applications until they dismiss the error. Is it possible to do a similar thing with an AHK GUI and a msgbox?
I've looked at the msgbox syntax article https://autohotkey.com/docs/commands/MsgBox.htm and at the +owndialogs option for the GUI but couldn't find what I'm looking for.

Right now I'm simply hiding the GUI when the particular msgbox appears and show it again when the msgbox is dismissed, but I think this is a crude solution and potentially confusing for the user. I could aim a guicontrol,+readonly at every control but I'm sure there must be a better way.

Any help would be appreciated :)
wolf_II
Posts: 2687
Joined: 08 Feb 2015, 20:55

Re: Msgbox to block user input

16 Dec 2018, 16:34

Try this:

Code: Select all

#NoEnv
#SingleInstance, Force

    Gui, Add, Button, x150 y100, Nasty NagBox
    Gui, Show

return ; end of auto-execute section

GuiClose:
ExitApp

ButtonNastyNagBox:
    Gui, +OwnDialogs
    MsgBox, 8192,, Click me!

return
I hope that helps.
Pepineros
Posts: 15
Joined: 16 Apr 2018, 17:26
Location: Ireland

Re: Msgbox to block user input

16 Dec 2018, 16:45

Thanks Wolf! I was already using something very similar. Your example did exactly what I needed so I dug a little deeper. Turned out the gui, +OwnDialogs I had was targeting the wrong GUI. Fixed by using gui,sass:+OwnDialogs where sass is the name of the GUI it should be targeting.

Thanks for pointing me in the right direction!

Return to “Ask For Help”

Who is online

Users browsing this forum: A_Perry_1984, AHKStudent, Bing [Bot], MalKov, MannyKSoSo, throwaway53245 and 241 guests