jackylee0908 Posted May 30, 2023 Posted May 30, 2023 (edited) 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 May 30, 2023 by jackylee0908
pixelsearch Posted May 30, 2023 Posted May 30, 2023 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
jackylee0908 Posted May 30, 2023 Author Posted May 30, 2023 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?
Solution pixelsearch Posted May 30, 2023 Solution Posted May 30, 2023 #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)
jackylee0908 Posted May 30, 2023 Author Posted May 30, 2023 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!
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