Jump to content

How the main window be set to unaccessable if the msgbox doesn't input and close yet.


Go to solution Solved by pixelsearch,

Recommended Posts

Hi sir,

I'd like to operator to input the msgbox first(i.e. click Yes or No button and then the msgbox window closed), then back to main window to continue the process, I understand I can let the msgbox on top from the main window as below code, but the operator still able to mouse click on the main window and do other functions that offered from main window, prior to the msgbox is been input.

MsgBox($MB_TOPMOST, "Notice", "Example message!")

So I need your help to advise how to set the main window unaccessable when a msgbox is pop out and until a msgbox is input and closed then the main window back to accessable.

Thanks,

Jacky

Edited by jackylee0908
Link to comment
Share on other sites

10 minutes ago, pixelsearch said:

Hi jackylee0908
Look at MsgBox in the help file, 4th and 5th parameter.
After that, I'm sure you'll know how to do it :)

Tried but still cannot work.

MsgBox($MB_TOPMOST, "Notice", "Example message!", HWnd)
MsgBox($MB_SETFOREGROUND, "Notice", "Example message!")

The back main window still is accessable.

Do you mind to let me know which is 4th and 5th parameter?

 

image.thumb.png.5997dcaac6b5fd2d550858c1cc6f2d16.png

image.thumb.png.37e02f481f766fe237a87501f72af78a.png

Link to comment
Share on other sites

  • Solution

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

$hGUI = GUICreate("Example", 400, 200)
$idButton1 = GUICtrlCreateButton("Button 1", 80, 80, 80, 30)
$idButton2 = GUICtrlCreateButton("Button 2", 220, 80, 80, 30)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButton1
            MsgBox($MB_TOPMOST, "Button 1 clicked", _
                "You cannot do anything with main window", 0, $hGUI) ; <===========

        Case $idButton2
            ConsoleWrite("You clicked button 2" & @crlf)
    EndSwitch
WEnd
GUIDelete($hGUI)

Link to comment
Share on other sites

20 minutes ago, pixelsearch said:

 

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

$hGUI = GUICreate("Example", 400, 200)
$idButton1 = GUICtrlCreateButton("Button 1", 80, 80, 80, 30)
$idButton2 = GUICtrlCreateButton("Button 2", 220, 80, 80, 30)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButton1
            MsgBox($MB_TOPMOST, "Button 1 clicked", _
                "You cannot do anything with main window", 0, $hGUI) ; <===========

        Case $idButton2
            ConsoleWrite("You clicked button 2" & @crlf)
    EndSwitch
WEnd
GUIDelete($hGUI)

 

Thanks, that worked for me, appreciated!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...