Sign in to follow this  
Followers 0
hendrikhe

main GUI is set to @SW_HIDE

2 posts in this topic

#1 ·  Posted (edited)

Hello,

It is driving me crazy...  Program was running fine till I decided to create a third GUI called $sAbout.

Here is the problem:

 

Case $sAbout; 
      Switch $nMsg[0]
               Case $AboutButtonOks  ; <<<<<< This is hiding for some reason my Main GUI right after program starts WITHOUT clicking on it
                       GUISetState(@SW_HIDE, $sAbout) 
               Case $GUI_EVENT_CLOSE   ; Works fine!
                      GUIDelete($sAbout)
               Case $GUI_EVENT_MINIMIZE
                     GUIDelete($sAbout) ; Works fine!
      EndSwitch

 

 

$nMsg = GUIGetMsg(1)
      Switch $nMsg[1] ; handle main GUI
            Case $GUI
               Switch $nMsg[0]
                  Case $GUI_EVENT_CLOSE
                     exit
                  Case $GUI_EVENT_MINIMIZE
                     GUISetState(@SW_HIDE)
                     
                  Case $Copy
                     saveTofile()
                     _ClipPutFile($file) ; put computerinfo file to the clipboard
                  Case $OpenFolder 
                     ShellExecute(@MyDocumentsDir & '\info\')
                  Case $ScreenShot
                     gui2() ; opens screenshot GUI
                  Case $web
                     ShellExecute("www.help.com")
                  Case $email
                     saveTofile()
                     ShellExecute("mailto:help@help.com")
                  Case $MenuHide
                     GUISetState(@SW_HIDE)
                  Case $MenuRefresh
                     saveTofile()
                     refresh()
                  Case $MenuEXit
                     Exit
                  Case $MenuOpenHelp
                     ShellExecute(@MyDocumentsDir & '\info\' & "info.txt")
                  Case $MenuScreen
                     gui2()
                  Case $MenuOnTop
                  Case $MenuAbout
                     About()

               EndSwitch


            Case $hBitmap_GUI ; handle main Screenshot GUI
               Switch $nMsg[0]
                  Case $GUI_EVENT_CLOSE
                     GUIDelete($hBitmap_GUI)
                  Case $CopyPICtoClip ; Copy Screenshot to clipboard
                     Global $sImageName = $Screeen_Path
                     If @error Then Exit

                     _GDIPlus_Startup ()
                     $hImage = _GDIPlus_ImageLoadFromFile($sImageName)
                     $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
                     $hBitmap = _WinAPI_CopyImage($hBmp, 0, 0, 0, $LR_COPYDELETEORG + $LR_COPYRETURNORG)

                     _ClipBoard_Open(0)
                     _ClipBoard_Empty()
                     _ClipBoard_SetDataEx($hBitmap, $CF_BITMAP)
                     _ClipBoard_Close()
                     _GDIPlus_ImageDispose($hImage)
                     _GDIPlus_Shutdown()



                  Case $FolderScreenshot ; open screenshot folder
                      ShellExecute(@MyDocumentsDir & '\info\Screenshots\')

               EndSwitch


               Case $sAbout; 
                Switch $nMsg[0]
                    Case $AboutButtonOks 
                        GUISetState(@SW_HIDE, $sAbout)

                    Case $GUI_EVENT_CLOSE
                        GUIDelete($sAbout)
                  Case $GUI_EVENT_MINIMIZE 
                        GUIDelete($sAbout)

               EndSwitch




      EndSwitch

      WEnd

EndFunc ; ==> End Func mainGUI()


Func About()
$sAbout = GUICreate("About", 322, 243, 809, 429)
$GroupBoxAbout = GUICtrlCreateGroup("", 8, 8, 305, 185)
$AboutImage1 = GUICtrlCreatePic("F:\Autoit\icon.jpg", 40, 32, 49, 49)
$AboutLabel1 = GUICtrlCreateLabel("Help Tool", 152, 24, 92, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$AboutLabel2 = GUICtrlCreateLabel("Version: 1.2.0", 152, 48, 69, 17)
$AboutLabel4 = GUICtrlCreateLabel("website:", 16, 160, 43, 17)
$AboutLabel3 = GUICtrlCreateLabel("Technical Support: ", 16, 136, 97, 17)
$AboutLabel5 = GUICtrlCreateLabel("Developed By: Name", 152, 72, 137, 17)
$AboutLabel6 = GUICtrlCreateLabel("name@name.com", 152, 88, 118, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$AboutLabel7 = GUICtrlCreateLabel("help@help.com", 112, 136, 175, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$AboutLabel8 = GUICtrlCreateLabel("www.help.com", 56, 160, 91, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AboutButtonOks = GUICtrlCreateButton("OK", 128, 208, 51, 25)
GUISetState(@SW_SHOW)
EndFunc

 

Edited by hendrikhe

Share this post


Link to post
Share on other sites



#2 ·  Posted

resolved with WinSetState ( "About", "", @SW_HIDE ) instead of GUISetState(@SW_HIDE, $sAbout) 

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  
Followers 0