Jump to content
Sign in to follow this  
GodlessSinner

Multiple GUI

Recommended Posts

GodlessSinner

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
$Form = GUICreate("Main window", 260, 99, 542, 678, BitOR($WS_POPUP,$WS_BORDER))
Opt("TrayMenuMode",1)
$open = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

GUISetState(@SW_SHOW)
$Form1 = GUICreate("About", 240, 127, 500, 500, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))

While 1
        $nMsg = GUIGetMsg(1)
        $tray = TrayGetMsg()
        Switch $tray
            Case $exititem
                Exit
            Case $open
                GUISetState(@SW_SHOW,$Form1)
                WinSetOnTop ($Form, "", 0)
        EndSwitch
        Select
        Case $nMsg[0] = $GUI_EVENT_CLOSE
        If $nMsg[1] = $Form1 Then
            GUISetState(@SW_HIDE, $Form1)
        ElseIf $nMsg[1] = $Form Then
            Exit
        EndIf
        Case $GUI_EVENT_PRIMARYDOWN
            _SendMessage($Form, $WM_SYSCOMMAND, 0xF012, 0)
EndSelect
    WEnd

Why "About" window can't be active? And how to prevent from clicking in main window when "About" is shown?

thanks.


_____________________________________________________________________________

Share this post


Link to post
Share on other sites
Melba23

Godless,

Your SendMessage is constantly reactivating the main window. Try testing to see if the "About" window is active before sending. As to preventing clicking in the main window, just Disable/Enable it when the "About" window shows:

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

Opt("TrayMenuMode", 1)

$open = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

$Form = GUICreate("Main window", 260, 99, 542, 678, BitOR($WS_POPUP, $WS_BORDER))
GUISetState(@SW_SHOW)

$Form1 = GUICreate("About", 240, 127, 500, 500, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetState(@SW_HIDE)

While 1

    $tray = TrayGetMsg()
    Switch $tray
        Case $exititem
            Exit
        Case $open
            GUISetState(@SW_SHOW, $Form1)
            WinSetOnTop($Form, "", 0)
            GUISetState(@SW_DISABLE, $Form)
    EndSwitch

    $nMsg = GUIGetMsg(1)
    Select
        Case $nMsg[0] = $GUI_EVENT_CLOSE
            If $nMsg[1] = $Form1 Then
                GUISetState(@SW_HIDE, $Form1)
                GUISetState(@SW_ENABLE, $Form)
            ElseIf $nMsg[1] = $Form Then
                Exit
            EndIf
        Case $GUI_EVENT_PRIMARYDOWN
            If BitAND(WinGetState($Form1), 2) <> 2 Then _SendMessage($Form, $WM_SYSCOMMAND, 0xF012, 0)
    EndSelect
WEnd

M23

Edit: Speeling

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×