Jump to content

GUI/MsgBox error


Recommended Posts

Okay, I've looked all over. I know the answer is probably just on the next page. But just like the code, I know it's better to have someone else look it over sometimes. Maybe in the future if someone is attempting this they will appreciate the example.

The problem is this: I've created a simple GUI with three buttons. One button launches an app then has said app go to the next screen. Second button does basically the same thing, but with Windows update. Third button just closes the box. Those all work fine. 

When I uncomment line 12 (Local $MsgM = GUICtrlCreateLabel("Application has completed all tasks. Please consider the following options.", 15, 35, 255, 150, $SS_CENTER)) All of the buttons cease to work. It works fine without the text(as it is below) I know there's probably a different way for me to add the text but for some reason I can't find it.

;App

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

App()

Func App()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Application done!", 275, 150)
    ; Create a horizontally centered text label for the inside of the GUI.
;   Local $MsgM = GUICtrlCreateLabel("Application has completed all tasks. Please consider the following options.", 15, 35, 255, 150, $SS_CENTER)

    ; Create a button control.
    ; Button Positioning(Horizontal from left, Vertical from top, Button Width, Button Height)
    Local $idLSU= GUICtrlCreateButton("Lenovo System Update", 5, 110, 130, 25)
    Local $idWUpdate = GUICtrlCreateButton("Windows Update", 140, 110, 130, 25)
    Local $idClose = GUICtrlCreateButton("Close", 121, 135, 32, 15)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $iPID = 0

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idClose
                ExitLoop

            Case $idLSU
                ; Run Lenovo System Utilty.
                $iPID = Run("C:\Program Files (x86)\Lenovo\System Update\TVSU.exe")
                WinWaitActive("System Update") ;Wait for it to be active before sending commands.
                Send("{Enter}") ;press next on LSU main screen.
            Case $GUI_EVENT_CLOSE, $idClose
                ExitLoop

            Case $idWUpdate
                ; Run Windows Update "Run("%windir%\system32\wuapp.exe startmenu")"
                $iPID = Run("wuapp.exe startmenu")
                WinWaitActive("Windows Update") ;Wait for it to be active before sending commands.
                Send("{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Enter}") ;Navigate to update link, then begin update check.

        EndSwitch
    WEnd

   ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)

    ; Close the window process using the PID returned by Run.
   If $iPID Then ProcessClose($iPID)
EndFunc

;App 

 Any insight, help or direction pointing would be greatly appreciated. I wouldn't have been able to get to this point without these boards.

 

 
Link to comment
Share on other sites

OMG, it's very simple why it isn't working.

WTF, your label in line is overlapping all controls below which cause an unresponsible button behaviour!

 

Use this line instead:

Local $MsgM = GUICtrlCreateLabel("Application has completed all tasks. Please consider the following options.", 15, 35, 255, 40, $SS_CENTER)

or

add GUICtrlSetState(-1, $GUI_DISABLE) just after that particular line to disable the lable control.

 

LOL

Br,

UEZ

PS: I love BBQ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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...