Jump to content

[SOLVED] Minimize 'pop-up' window from taskbar


Yuljup
 Share

Recommended Posts

Hi,

Is it possible to minimize pop-up windows from the taskbar?

I've previously created minimize buttons in my projects, which works fine, but I just thought I'd ask in case anyone knew.

 

#include <GUIConstants.au3>
#include <SendMessage.au3>
Global Const $SC_DRAGMOVE = 0xF012

$ExampleGUI = GUICreate("Example", 300, 220, -1, -1, BitOR($WS_POPUP, $WS_BORDER))

GUISetState()

While 1
    Local $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $ExampleGUI
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($ExampleGUI)
                    ExitLoop
                Case $GUI_EVENT_PRIMARYDOWN
                    _SendMessage($ExampleGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
            EndSwitch
    EndSwitch
WEnd

 

Edited by Yuljup
Link to comment
Share on other sites

  • Moderators

Yuljup,

You could certainly minimize and restore the GUI using the menu from the systray icon - I have no idea how you might do it from the icon in the taskbar itself.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

Yuljup,

Other than simply clicking on the taskbar icon as you do for any other window, of course!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

M23,

Are you saying that you do not get the same behaviour as I do?

This is pretty much what I've been doing.

#include <GUIConstants.au3>
#include <SendMessage.au3>
Global Const $SC_DRAGMOVE = 0xF012

$ExampleGUI = GUICreate("Example", 300, 220, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
Local $MinimizeButton = GUICtrlCreateButton("Minimize", 90, 30, 50, 20)
Local $CloseButton = GUICtrlCreateButton("Close", 155, 30, 50, 20)

GUISetState()

While 1
    Local $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $ExampleGUI
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($ExampleGUI)
                    ExitLoop
                Case $GUI_EVENT_PRIMARYDOWN
                    _SendMessage($ExampleGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
             Case $MinimizeButton
                 GUISetState(@SW_MINIMIZE)
             Case $CloseButton
                 Exit
            EndSwitch
    EndSwitch
WEnd

 

If you remove the "BitOR($WS_POPUP, $WS_BORDER)" part, minimize works fine from the taskbar.

#include <GUIConstants.au3>
#include <SendMessage.au3>
Global Const $SC_DRAGMOVE = 0xF012

$ExampleGUI = GUICreate("Example", 300, 220, -1, -1)
Local $MinimizeButton = GUICtrlCreateButton("Minimize", 90, 30, 50, 20)
Local $CloseButton = GUICtrlCreateButton("Close", 155, 30, 50, 20)

GUISetState()

While 1
    Local $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $ExampleGUI
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($ExampleGUI)
                    ExitLoop
                Case $GUI_EVENT_PRIMARYDOWN
                    _SendMessage($ExampleGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
             Case $MinimizeButton
                 GUISetState(@SW_MINIMIZE)
             Case $CloseButton
                 Exit
            EndSwitch
    EndSwitch
WEnd

 

Edited by Yuljup
Link to comment
Share on other sites

  • Moderators

Yuljup,

I see now - just add the $WS_MINIMIZEBOX & $WS_SYSMENU styles and you will find that the taskbar icon will also minimize/restore on clicking.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

Yuljup,

And you too. Glad I could help.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

Skysnake,

a standard Window

There is the problem with that suggestion - what is "a standard Window"? For me, it is probably the default as defined on the GUICreate Help file page - for others it could well be very different. Anyway, adding the $WS_MINIMIZEBOX  style to a GUI which apparently would not minimize seemed a pretty logical thing to try.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Thanks for the reply. On another platform the question arose as to "the one best way" to do anything.  Those who can, have many tools available to them. Those who are still learning need a clear path to follow, in order to develop their own tools.  All that I am suggesting is that when working in a Windows environment, users expect certain -standard- behaviour. Guiding the novice on the correct path initially can do no harm?

Skysnake

Why is the snake in the sky?

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