Jump to content
31290

About Box issue

Recommended Posts

31290

Hi everyone, 

Hope you're doing great today.

I've made a script that include 5 GUIS all containing a little menu bar.

    ;GUI Menus
Func Menus()    
    Global $MenuItem1 = GUICtrlCreateMenu("?")
    Global $MenuItem2 = GUICtrlCreateMenuItem ("Help", $Menuitem1)
    Global $MenuItem3 = GUICtrlCreateMenu("Exits")
    Global $MenuItem4 = GUICtrlCreateMenuItem("Exit Software", $MenuItem3)
    Global $MenuItem5 = GUICtrlCreateMenuItem("Exit And Delete Resources", $MenuItem3)
    Global $MenuItem6 = GUICtrlCreateMenu("About")
    Global $MenuItem7 = GUICtrlCreateMenuItem("About", $MenuItem6)
EndFunc

And here's one of my GUI's:

    ; Creating Tech GID GUI
Func TechGui ()
    Global $TechGui = GUICreate ("Automated Task List Suite", 270, 180, -1, -1)
    Menus()
    GUISetIcon ($Images & "\TechGUI.ico")
    GUISetBkColor ($Color_White)
    GUICtrlCreatePic ($Images & "\SAClogo.jpg", 14, 10, 240, 80)
    GUICtrlCreateLabel ("Please Enter Your Global ID:", -1, 100, 150, 20)
    GUICtrlSetFont (-1, 8.5, 700, 0)
    Local $TechGiDInput = GUICtrlCreateInput ("", -1, 130, 100, 20)
    Local $TechBtn = GUICtrlCreateButton ("OK", 120, 127, 30, 25, 0x0001)
    While 1
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
        GUISetState ()
        Local $TechMsg = GUIGetMsg ()
        Switch $TechMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $TechBtn
                Global $TechGiD = GUICtrlRead ($TechGiDInput)
                 FileOpen ($Resources & "\TechGID.txt", $FO_OVERWRITE)
                    FileWrite ($Resources & "\TechGID.txt", $techGID)
                    FileClose ($Resources & "\TechGID.txt")
                If  ($TechGiD == "") Then
                    Msgbox (16, "ERROR", "You can't be a ghost, try again")
                Else
                    GUIDelete ($TechGui)
                    CmpModelGui ()
                Endif
        EndSwitch
        Select
                        Case $TechMsg = $MenuItem7
                About()
        EndSelect
    WEnd
EndFunc

The problem is that when I call the about box and when I close it, all buttons from the calling GUI are disabled... Also, is it possible to create a general about box without having to associate it to the GUI calling it?

In fact, I'd love to have this kind of AboutBox: 

#Include <GUIConstantsEx.au3>

$hForm = GUICreate('MyGUI', 400, 400)
$Button = GUICtrlCreateButton('About', 165, 366, 70, 23)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Button
            _WinAPI_ShellAbout('About', 'About Dialog Box Test', 'Simple Text', _WinAPI_SHExtractIcons('shell32.dll', 130, 33, 33), $hForm)
    EndSwitch
WEnd

Func _WinAPI_ShellAbout($sTitle, $sName, $sText, $hIcon = 0, $hParent = 0)

    Local $Ret = DllCall('shell32.dll', 'int', 'ShellAbout', 'hwnd', $hParent, 'str', $sTitle & '#' & $sName, 'str', $sText, 'ptr', $hIcon)

    If (@error) Or ($Ret[0] = 0) Then
        Return SetError(1, 0, 0)
    EndIf
    Return 1
EndFunc   ;==>_WinAPI_ShellAbout

Func _WinAPI_SHExtractIcons($sIcon, $iIndex, $iWidth, $iHeight)

    Local $Ret = DllCall('shell32.dll', 'int', 'SHExtractIconsW', 'wstr', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0)

    If (@error) Or ($Ret[0] = 0) Or ($Ret[5] = Ptr(0)) Then
        Return SetError(1, 0, 0)
    EndIf
    Return $Ret[5]
EndFunc   ;==>_WinAPI_SHExtractIcons

But I don't know how can I personalize it and integrate it in my script.
Many thanks in advance for you generous help :D

 

Edited by 31290

~~~ Doom Shall Never Die, Only The Players ~~~

Share this post


Link to post
Share on other sites
kylomas

31290,

You really do NOT want to run this in your message loop

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

For further help please post a runnable reproducer using code tags.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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

×