Sign in to follow this  
Followers 0
Hyflex

Hide a taskbar item?

7 posts in this topic

I run a vent serveron my pc and i want to get rid of the Item at the bottom on my taskbar, i want to hide it...

Share this post


Link to post
Share on other sites



Bump

Share this post


Link to post
Share on other sites

XxXGoD

Try this:

#include <GuiToolBar.au3>

$ButtonText = "Безымянный" ;Change to notepad title

Run("notepad.exe", @WindowsDir, @SW_MINIMIZE)

WinWait("[Class:Notepad]")

$hParent = WinGetHandle("[Class:Shell_TrayWnd]")

$hToolBar = ControlGetHandle($hParent, "", "ToolbarWindow322")

MsgBox(0, "Warning", "Now we hide the Notepad button on taskbar")

$count = _GUICtrlToolbar_ButtonCount($hToolBar)

For $i = 0 To $count - 1
    $ID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)

    If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $ID), $ButtonText) Then
        _GUICtrlToolbar_SetButtonState($hToolBar, $ID, $TBSTATE_HIDDEN)
        ExitLoop
    EndIf
Next

MsgBox(0, "Warning", "Now we show the Notepad button on taskbar")

_GUICtrlToolbar_SetButtonState($hToolBar, $ID, $TBSTATE_ENABLED)

Share this post


Link to post
Share on other sites

#include <GuiToolBar.au3>

$ButtonText = "C:\Program Files\VentSrv\116.exe" ;Change to notepad title

Run("116.exe", "C:\Program Files\VentSrv\", @SW_MINIMIZE)

WinWait("[Class:116]")

$hParent = WinGetHandle("[Class:Shell_TrayWnd]")

$hToolBar = ControlGetHandle($hParent, "", "ToolbarWindow322")

MsgBox(0, "Warning", "Now we hide the Notepad button on taskbar")

$count = _GUICtrlToolbar_ButtonCount($hToolBar)

For $i = 0 To $count - 1
    $ID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)

    If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $ID), $ButtonText) Then
        _GUICtrlToolbar_SetButtonState($hToolBar, $ID, $TBSTATE_HIDDEN)
        ExitLoop
    EndIf
Next

MsgBox(0, "Warning", "Now we show the Notepad button on taskbar")

_GUICtrlToolbar_SetButtonState($hToolBar, $ID, $TBSTATE_ENABLED)

That just automatically minimies it, i want it to be running but totally hidden..

Share this post


Link to post
Share on other sites

Run("116.exe", "C:\Program Files\VentSrv\", @SW_HIDE)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

That works but doesn't work...

It hides the program now, just doesn't actually work i need it to run the program for 30secs and then hide it...

edit: the msg box's are not working...

Edited by XxXGoD

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

That works but doesn't work...

It hides the program now, just doesn't actually work i need it to run the program for 30secs and then hide it...

edit: the msg box's are not working...

You can hide a program from the task bar if it's not visible, and you you don't see child windows on the task bar. So you just create a gui, don't show it so it isn't on the task bar, then make the application a child of that gui.

Here's an example but be careful to press F10 to end the program as instructed if there are any hidden windows when you want to quit.

#include <guiconstants.au3>
#include <constants.au3>
#include <windowsconstants.au3>

Opt("TrayIconHide", 1)

$hGui1 = GUICreate('Parent');this is the 'holder' for hidden apps
;GUISetState();hide the parent from task bar as well or remove comment to show it
MsgBox(262144, 'Hide and Seek', 'To Hide the active window press F8' & @CRLF & 'To bring back the last hidden window press F9' & _
        @CRLF & 'To restore all and quit press F10')
Dim $origparent[20][2], $index = 0
Global $hiddenwindow
HotKeySet("{F8}", "Hide")
HotKeySet("{F9}", "Show")
HotKeySet("{F10}", "Leave")
While 1
;next line not needed, it's just to stop anyone seeing your app is running
    If WinExists("Windows Task Manager") Then WinClose("Windows Task Manager")
    Sleep(100)

WEnd

Func Hide()
    If $origparent[$index][0] <> 0 Then Return
    $title = WinGetTitle("")
    
    If $title = 'Program Manager' Then;caution - this is language dependent I assume
        MsgBox(0, "ERROR", "Can't hide Program Manager")
        Return
    EndIf

    $origparent[$index][1] = WinGetHandle($title)
    $origparent[$index][0] = DllCall("user32.dll", "int", "SetParent", "hwnd", $origparent[$index][1], "hwnd", $hGui1)
    $index += 1

    If UBound($origparent) < $index + 2 Then ReDim $origparent[$index + 5][2]
EndFunc ;==>Hide

Func Show()
    If $index = 0 Then Return
    If $origparent[$index - 1][0] = 0 Then Return
    DllCall("user32.dll", "int", "SetParent", "hwnd", $origparent[$index - 1][1], "hwnd", $origparent[$index - 1][0])
    WinActivate($origparent[$index - 1][1])
    $origparent[$index - 1][0] = 0
    $index -= 1
EndFunc ;==>Show

Func Leave()
    
    While $index > 0
        Show()
    WEnd
    Exit
EndFunc ;==>Leave

Func OnAutoItExit()
    
    Leave()
    
EndFunc ;==>OnAutoItExit
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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