Sign in to follow this  
Followers 0
IanN1990

[Solved] Alt + Tab hide icons

11 posts in this topic

#1 ·  Posted (edited)

I want to start using alt and tab more, but the problem is i have so much open by default it makes navigating between what i really want hard. Is there any way for me to use Autoit to hide some of those icons ?

and a second small question. Assuming something has focus like WinActivate("[class:Notepad]"), is there any way to remove active status from that program but not give it to anything else ?

Edited by IanN1990

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1. You could hide the window(s) with the WinSetState function, or you could use a program such as this - written and shared by KaFu. A hidden program is not Alt-Tabbable

2. The only way I know of to not give focus to any program is to power off the PC. Focus has to go somewhere.. You could use the WinSetOnTop function though, to leave an unfocused program where it is, while the focus is on another program.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Always nice seeing a reference ;), thanks somdcomputerguy. In HMW I use the function _WinGetAltTabWinList by Ascend4nt. In this function he documented the following:

; Extended Style bits WS_EX_NOACTIVATE (0x08000000) and WS_EX_TOOLWINDOW (0x80) indicate non-Alt-Tab windows,

; but if bit WS_EX_APPWINDOW (0x040000) is set, then it is still Alt-Tab-able

You can use the function to get a list of Alt-Tabable :) windows and then loop through that list adjusting the styles of those windows you want to remove from the list using _WinAPI_SetWindowLong correspondingly. I'm not sure if the style change is applied instantly or if you need to hide and unhide (e.g. by _WinAPI_ShowWindow()) the window again to apply it.

Share this post


Link to post
Share on other sites

thanks for ur replies somdcomputerguy and kafe, the wingetalttablist sounds very promising i will look into that imminently :)

As far of the focus idea, reading your post made me think "what happens to focus when a program is closed" which then lead me to creative ;)

$hGUI = GUICreate("Test", 0, 0)

WinActivate("Test")

Winclose("Test")

Makes a gui, gives it focus, kills it :D

Share this post


Link to post
Share on other sites

..made me think "what happens to focus when a program is closed"

Usually (probably almost always..), focus goes back to whatever program had it before the second program was opened, which you probably found out from your test.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

yea seams your right, maybe i got my hopes up too soon i guess :)

Edited by IanN1990

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@68852

well the idea of my code is if u click the desktop, it shows all the icons. If u unclick the desktop after 10 seconds it hides it but i wanted to add some code if u click the desktop but dont move the mouse after 10 secs it hides it again. I thought the best way of doing that would be to unfocus it :) So in ur example setting the desk as focus wouldn't work but i did use the idea of setting another hidden application as focus ;)

@KaFu

So i downloaded and installed your link, ran the test code getting

[0]|13||

[1]|Windows Live Messenger|0x00010310|MSBLWindowClass

[2]|Friends|0x0003049E|USurface_822813

[3]|Skype™ (BETA) - edited|0x0001024E|tSkMainForm

[4]|C:Program Files (x86)Scripts00¦ MiscellaneousMicrosoftStorageTest.au3 - SciTE4AutoIt3|0x003402A2|SciTEWindow

[5]|Hotmail - edited@hotmail.co.uk - Windows Live - Mozilla Firefox|0x0403072E|MozillaWindowClass

[6]|AutoIt Help|0x002607B8|HH Parent

[7]|Include|0x0037046C|CabinetWClass

[8]|Internet Download Manager 6.07|0x0003037C|#32770

[9]|edited - Chat|0x003306FC|USurface_822813

[10]|Windows Media Player|0x00010414|WMPlayerApp

[11]|User Moderation - AutoIt Forums - Mozilla Firefox|0x003D068E|MozillaWindowClass

[12]||0x0010052A|AutoIt v3 GUI

[13]|Untitled - Notepad|0x00410380|Notepad

So how would i use the _WinAPI_SetWindowLong to hide notepad from the list ?

Edited by IanN1990

Share this post


Link to post
Share on other sites

Using

Opt('WinTitleMatchMode', 2 )
#include "_WinGetAltTabWinList.au3"
#include <Array.au3>
Local $aWindows=_WinGetAltTabWinList("","",True)
_ArrayDisplay($aWindows)

#include <Constants.au3>
#include <WinAPI.au3>

$b = WinGetHandle("[CLASS:MSBLWindowClass]")
$c = WinGetHandle("[CLASS:tSkMainForm]")
$d = WinGetHandle("[CLASS:WMPlayerApp]")
$e = WinGetHandle("[CLASS:AutoIt v3 GUI]")
$f = WinGetHandle("Program Manager")
$g = WinGetHandle("Friends")

_WinAPI_SetWindowLong($b, $GWL_Exstyle, 0x08000000)
_WinAPI_SetWindowLong($c, $GWL_Exstyle, 0x08000000)
_WinAPI_SetWindowLong($d, $GWL_Exstyle, 0x08000000)
_WinAPI_SetWindowLong($e, $GWL_Exstyle, 0x80000000)
_WinAPI_SetWindowLong($f, $GWL_Exstyle, 0x08000000)
_WinAPI_SetWindowLong($g, $GWL_Exstyle, 0x08000000)

Works nicely at removing lots of those unneeded ones :) but i cant hide desktop ? Any ideas

Share this post


Link to post
Share on other sites

One last question

#include <Constants.au3>
#include <WinAPI.au3>
$b = WinGetHandle("[CLASS:MSBLWindowClass]")
if _WinAPI_GetWindowLong($b, $GWL_Exstyle) = (0x08000000) Then
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
EndIf

Is my failed attempt :) but how do i write it to do a if statement "if window = 0x0800000) then do this ??

Share this post


Link to post
Share on other sites

Seams my code was well off :) thanks for giving the correct syntax and all ur help on this little project

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