Jump to content

hiding external windows from taskbar


Recommended Posts

Hello,

i've a stupid question, but i hope that anyone could help me.

i work with RealVNC a lot and there are always three or more windows opened. i tinkered a AU-script to hide this windows by hotkey which was no problem for me.

now i want to create a script to hide these windows from taskbar, when they are on SW_SHOW, to prevent them from showing in taskbar cauz my taskbar is getting fuller and fuller of this annoying VNC-"buttons". the windows should keep visible - only the taskbar buttons should be hidden.

could this be done with autoit?

Thank you for your effort!

hxr0x

Link to comment
Share on other sites

This might help. However, if you minimize the window it "disappears"...

Run("calc")
WinWait("Calculator")

$window = WinGetHandle("Calculator")
$newParent = WinGetHandle("Program Manager")
DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $window, "hwnd", $newParent)

See http://www.autoitscript.com/forum/index.php?showtopic=81 for more info

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • 6 months later...

Hi,

A question:

I need a function that hides an application in taskbar but it should be shown in ALT+TAB dialog so that I can switch back to this application.

Something like:

; $strWindowTitle = window title as string

; $blnVisible = visible as boolean

Func ShowInTaskbar($strWindowTitle, $blnVisible)

If $blnVisible = True Then

{Code to show window in taskbar}

Else

{Code to hide window in taskbar}

EndIf

EndFunc

How can I do that?

Cu,

Buffo

Edited by Buffo
Link to comment
Share on other sites

...and? Are you asking how to apply that style to an external window?

I believe you can use this:

http://www.autoitscript.com/forum/index.ph...wtopic=9517&hl=

and the function _TargetStyle() in it to set the external window's extended style to $WS_EX_TOOLWINDOW

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

That's new to me. Interesting ... :P

But I don't know what's the right code. I tried with my opened AutoIt-Help-Window:

#include <AnyGUI.au3>

_GUITarget("AutoIt Help")
_TargetStyle("set", -1, -1, $WS_EX_TOOLWINDOW, 1)

But it don't work for me ;)

What code I have to use for hide and for show?

Thx a lot.

Cu,

Buffo

Link to comment
Share on other sites

That's new to me. Interesting ... :P

But I don't know what's the right code. I tried with my opened AutoIt-Help-Window:

#include <AnyGUI.au3>

_GUITarget("AutoIt Help")
_TargetStyle("set", -1, -1, $WS_EX_TOOLWINDOW, 1)

But it don't work for me ;)

What code I have to use for hide and for show?

Thx a lot.

Cu,

Buffo

#include <ANYGUIv2.6.au3>

$mywindow = _GuiTarget("AutoIt Help")
$mywindowstyles = _TargetStyle("set", 1, -1, $WS_EX_TOOLWINDOW, $mywindow)

try that.....

P.S. the code above assumes you placed ANYGUIv2.6.au3 in your include folder

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

Thx for your support ;)

I know that the include-command is for including from include folder, but for testing purposes I put your UDF renamed AnyGui.au3 in my local folder.

Your code does the following: The window style of the help file becomes to toolbar style, but the button in taskbar remains. So this is not the solution, too.

Please help me, I need another tip :P

Cu,

Buffo

Link to comment
Share on other sites

While searching the web for examples in other programming languages I found the following VB-Script. Maybe someone can interpret this and help me in AutoIt.

----------------

Preparations

----------------

Add 2 Command Buttons to your form.

----------------

Module Code

----------------

Public Declare Function GetWindowLong Lib "user32" Alias _

"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Public Declare Function SetWindowLong Lib "user32" Alias _

"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _

ByVal dwNewLong As Long) As Long

Public Declare Function ShowWindow Lib "user32" (ByVal hwnd _

As Long, ByVal nCmdShow As Long) As Long

Public Const SW_HIDE = 0

Public Const SW_SHOW = 5

Public Const GWL_EXSTYLE = (-20)

Public Const WS_EX_TOOLWINDOW = &H80&

Public Sub setShowInTaskbar(Visible As Boolean, hwnd As Long)

Dim L As Long

L = ShowWindow(hwnd, SW_HIDE)

DoEvents

L = SetWindowLong(hwnd, GWL_EXSTYLE, IIf(Visible, -WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW))

DoEvents

L = ShowWindow(hwnd, SW_SHOW)

End Sub

--------------

Form Code

--------------

Private Sub Command1_Click()

Call setShowInTaskbar(True, Me.hwnd)

End Sub

Private Sub Command2_Click()

Call setShowInTaskbar(False, Me.hwnd)

End Sub

Link to comment
Share on other sites

Thx for your support ;)

I know that the include-command is for including from include folder, but for testing purposes I put your UDF renamed AnyGui.au3 in my local folder.

Your code does the following: The window style of the help file becomes to toolbar style, but the button in taskbar remains. So this is not the solution, too.

Please help me, I need another tip :P

Cu,

Buffo

hmmmm...........

try 'unsetting' $WS_EX_APPWINDOW from the extended styles of your window....worth a shot...

[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

Here's my feeble attempt at translating your VB code. I just tried it and got some very weird results though; can anyone see any obvious glitches? --

global const $SW_HIDE = 0

global const $SW_SHOW = 5

global const $GWL_EXSTYLE = -20

global const $WS_EX_TOOLWINDOW = 0x80

func setShowInTaskbar($visible, $handle)

local $setting = $WS_EX_TOOLWINDOW

if $visible then $setting = 0 - $WS_EX_TOOLWINDOW

dllCall("user32.dll", "long", "ShowWindow", "hwnd", $handle, "long", $SW_HIDE)

dllCall("user32.dll", "long", "SetWindowLong", "hwnd", $handle, "int", $GWL_EXSTYLE, "long", $setting)

dllCall("user32.dll", "long", "ShowWindow", "hwnd", $handle, "long", $SW_SHOW)

endFunc

setShowInTaskbar(false, winGetHandle("Some window's title"))

Link to comment
Share on other sites

@LxP: Great job! Unfortunalety the window will be completely hidden. But for what I want to do it's not important, I can use it ;)

@quaizywabbit: Maybe that's the problem, I don't know.

@all: Thx a lot for your tireless support :P

Cu,

Buffo

Edited by Buffo
Link to comment
Share on other sites

  • 5 months later...

I wanted to hide WinAmp's taskbar button (WinAmp3 on Win XP SP2) with your code but nothing happened. I tried to cycle through all WinAmp windows:

Opt("WinTitleMatchMode",4)
$win = WinList("classname=BaseWindow_RootWnd")

MsgBox(0,"Windows:",$win[0][0])
$newParent = WinGetHandle("Program Manager")
For $i=1 to $win[0][0] 
 MsgBox(0,$i&"-th window title:",$win[$i][0])
 DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $win[$i][1], "hwnd", $newParent)
Next

but the taskbar button stayed there. WinSetStyle(@SW_HIDE) doesn't hide the button, too. Any ideas?

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