Jump to content

How do I stop a window from appearing on the Task Bar?


Recommended Posts

I know I did this before. But I can not find in help, find in old code nor remember.

I have a program with a tiny window. Some times I have up to four instances of it running.

I do not want the windows from cluttering up the task bar.

How do I accomplish this?

[size="2"]The second mouse gets the cheese[/size]
Link to comment
Share on other sites

hi,

Set the GUI's style to be $WS_EX_TOOLwindow. :unsure:

Here's a quick example:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 191, 83, 265, 153)
$Button1 = GUICtrlCreateButton("show in taskbar", 3, 3, 184, 37, $WS_GROUP)
$Button2 = GUICtrlCreateButton("dont show in taskbar", 3, 42, 184, 37, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$defStyle=GUIGetStyle()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUISetState(@SW_HIDE)
            GUISetStyle(-1,$defStyle[1])
            GUISetState(@SW_SHOW)
        Case $Button2
            GUISetState(@SW_HIDE)
            GUISetStyle(-1,$WS_EX_TOOLWINDOW)
            GUISetState(@SW_SHOW)
    EndSwitch
WEnd

Hope this helps,

-smartee

Link to comment
Share on other sites

I couldn't get that to do what I wanted. And the example doesn't use that which confuses me.

But it did get me thinking where I should be looking, and I found what I had done before.

Thank you. I still can't get over how fast you guys are.

One more question.

GuiSetState sets a value, but is there something to function like GUIGetState?

[size="2"]The second mouse gets the cheese[/size]
Link to comment
Share on other sites

hi,

the example doesn't use that which confuses me

The example does use the $WS_EX_TOOLWINDOW property, don't you see this line :unsure:
GUISetStyle(-1,$WS_EX_TOOLWINDOW)

Maybe a simpler example would clear things up: :>

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Not in taskbar", 200, 100, -1, -1, -1, $WS_EX_TOOLWINDOW)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Try using WinGetState() to get the GUI's state.

Hope this clears some thing up ;)

-smartee

Link to comment
Share on other sites

The eyes aren't what they use to be (and they weren't that good then)

Sorry. That is many characters shorter than my method.

And thanks for the pointer, off to look at it now. :unsure:

[size="2"]The second mouse gets the cheese[/size]
Link to comment
Share on other sites

Or you could make the Main GUI as a child to AutoItWinGetTitle() (a Hidden Window) and then you'll have a normal looking GUI instead of the $WS_EX_TOOLWINDOW style. It will minimise to the top of the Taskbar.

GUICreate("Using AutoItWinGetTitle()", 200, 100, -1, -1, -1, -1, WinGetHandle(AutoItWinGetTitle()))
GUISetState(@SW_SHOW)
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd
Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

owww nice this post ;)

just what i needed but maybe a little more difficult (for me anyway :> )

I'm making a GUI whit a hidden help GUI.

In the futher i'm making more GUI's from one father GUI.....

Is it possible to make a child GUI or a father GUI disapere from the taskbar but not from the notification area?

This because i'm making a script whit a nice little icon in the notification area ;)

(this is a script i'm making whit what i've learned here in the forum from many poeple :unsure: )

I'treid to put the $WS_EX_TOOLWINDOW into this script but it's making a lot of windows :D

do i do something wrong?

Could someone help me whit this?

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Animate.au3>

;$GUI = GUICreate("Test", 615, 438, -1, -1)
$GUI = GUICreate("Test", 615, 438, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))
$Button1 = GUICtrlCreateButton("Hide father GUI", 3, 3, 184, 37, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Hide child GUI", 3, 42, 184, 37, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Hide father and child GUI", 3, 81, 184, 37, $WS_GROUP)
$ContextMenu = GuiCtrlCreateContextMenu()
$SubMenu = GuiCtrlCreateMenu("SubMenu", $ContextMenu)
$SubMenuItem = GuiCtrlCreateMenuItem("SubMenu Help", $SubMenu)
$HelpItem = GuiCtrlCreateMenuItem("Help", $ContextMenu)
$defStyle=GUIGetStyle()
GUISetState(@SW_SHOW)
Opt('MustDeclareVars', 1)


Global $GuiMsg
Global $Show = False
Global $HelpGUI = GUICreate("Help Gui", 500, 200)
HotKeySet("^z", "ShowHelpGUI")

_Animate_LoadFromFile(@ScriptDir & '\Images\flag.png')
_Animate_SetDelay(80)
_Animate_ShowIcon()
_Animate_Start()

While 1
    $GuiMsg = GuiGetMsg()
    Select
    Case $GuiMsg = $HelpItem
        ShowHelpGUI()
    Case $GuiMsg = $SubMenuItem
        MsgBox(0, "test", "You pressed the 'Help' item in the sub context menu")
    Case $GuiMsg = $Gui_Event_Close
        Exit
    Case $Button1
        GUISetState(@SW_HIDE)
        GUISetStyle(-1,$defStyle[1])
        GUISetState(@SW_SHOW)
    Case $Button2
        GUISetState(@SW_HIDE)
        GUISetStyle(-1,$WS_EX_TOOLWINDOW)
        GUISetState(@SW_SHOW)
    EndSelect
WEnd

Func ShowHelpGUI()
    $Show = Not $Show
    GUISetState($Show, $HelpGui)
EndFunc
Edited by FMS

as finishing touch god created the dutch

Link to comment
Share on other sites

Thnx that did indeed the trick for hiding and unhiding the windows :unsure:

but now the second problem,... how can i change the focus to which window?

1 button for the child

1 for the father

1 for both ????

or isn't that possible and shout i look for another way?

I realy whish this because it's clutering mine taskbar whit a lot of windows in this way:D

what i have at this point is

;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Animate.au3>

;$GUI = GUICreate("Test", 615, 438, -1, -1)
$GUI = GUICreate("Test", 615, 438, -1, -1);, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))
$Button1 = GUICtrlCreateButton("Hide father GUI", 3, 3, 184, 37, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Hide child GUI", 3, 42, 184, 37, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Hide father and child GUI", 3, 81, 184, 37, $WS_GROUP)
$ContextMenu = GuiCtrlCreateContextMenu()
$SubMenu = GuiCtrlCreateMenu("SubMenu", $ContextMenu)
$SubMenuItem = GuiCtrlCreateMenuItem("SubMenu Help", $SubMenu)
$HelpItem = GuiCtrlCreateMenuItem("Help", $ContextMenu)
$defStyle=GUIGetStyle()
GUISetState(@SW_SHOW)
Opt('MustDeclareVars', 1)



Global $GuiMsg
Global $Show = False
Global $HelpGUI = GUICreate("Help Gui", 500, 200)
HotKeySet("^z", "ShowHelpGUI")

_Animate_LoadFromFile(@ScriptDir & '\Images\flag.png')
_Animate_SetDelay(80)
_Animate_ShowIcon()
_Animate_Start()

While 1
    $GuiMsg = GuiGetMsg()
    Select
    Case $GuiMsg = $HelpItem
        ShowHelpGUI()
    Case $GuiMsg = $SubMenuItem
        MsgBox(0, "test", "You pressed the 'Help' item in the sub context menu")
    Case $GuiMsg = $Gui_Event_Close
        Exit
    Case $GuiMsg=$Button1
        GUISetState(@SW_HIDE)
        GUISetStyle(-1,$defStyle[1])
        GUISetState(@SW_SHOW)
    Case $GuiMsg=$Button2
        GUISetState(@SW_HIDE)
        GUISetStyle(-1,$WS_EX_TOOLWINDOW)
        GUISetState(@SW_SHOW)
    Case $GuiMsg=$Button3
        GUISetState(@SW_HIDE)
        GUISetStyle(-1,$WS_EX_TOOLWINDOW)
        GUISetState(@SW_SHOW)
    EndSelect
WEnd

Func ShowHelpGUI()
    $Show = Not $Show
    GUISetState($Show, $HelpGui)
EndFunc

as finishing touch god created the dutch

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