Alt-Tab replacement related- getting only alt-tab windows
e.g. Winamp is listed when it shouldn't be, and not only once, but twice for me because of its main window and playlist. PSPad and Avant Browser have similar problems. In total I have 10 proper Alt-Tab windows but 14 listed by Alt-Tab replacement scripts and my own (basically they all use: winget, wind, List,,,Program Manager)
So, is there a way of somehow excluding those windows which aren't helpful for Alt-Tab? (it's nothing to do with invisible windows). It would be possible to make a really nice Alt-Tab replacement to fulfil my needs with AutoHotkey without this issue.
Managing Taskbar Buttons
The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
Try WinGet with the ExStyle parameter.
WS_EX_APPWINDOW = 0x40000 WS_EX_TOOLWINDOW = 0x80
Also, GetParent to determine if the window is owned.
shimanov: I'll try looking into that. I think you're right that it's only programs listed on the taskbar that appear in Alt-Tab.
I think you're right that it's only programs listed on the taskbar that appear in Alt-Tab.
In fact, they should be exactly the same.
To switch between running programs
Click a program's button on the taskbar.
Notes
If you cannot see the taskbar... You can also switch to the last open program or document by pressing ALT+TAB
Try WinGet with the ExStyle parameter.
WS_EX_APPWINDOW = 0x40000 WS_EX_TOOLWINDOW = 0x80
Also, GetParent to determine if the window is owned.
Regarding ExStyle, so far I've not managed to spot a reliable pattern for which windows are and aren't displayed - 0x00000100 (WS_EX_WINDOWEDGE) is also common, and then there are other combinations/variations (not sure of the terminology).
I tried having a look at GetParent, but to be honest I think it's a little beyond my AHK skills at the moment :oops:
http://www.thescarms...asic/alttab.asp
GetParent stuff eludes me still :wink:
Just a matter of time and practice.
It seems that there is a one-to-one correlation with respect to the number of windows in the taskbar and the Alt+Tab task switcher (ATTS). Unfortunately, there is some discrepancy between the "title" information displayed on the buttons of the taskbar and the information field of ATTS. From what I can tell, the "title" information present in ATTS is taken from the last active (highest z-order) window associated for a particular process, unless that process has more than one window which meets the taskbar criteria. But I have not discovered a reliable method to determine from which window ATTS retrieves its "title" information. In fact, Microsoft's own PowerToy replacement for ATTS displays "title" information that directly matches that of the taskbar and not the standard ATTS -- fun.
Try the following and you decide:
DetectHiddenWindows, Off WS_EX_APPWINDOW = 0x40000 WS_EX_TOOLWINDOW = 0x80 GW_OWNER = 4 WinGet, list, List text= loop, %list% { wid := list%A_Index% WinGet, es, ExStyle, ahk_id %wid% if ( ( ! DllCall( "GetWindow", "uint", wid, "uint", GW_OWNER ) and ! ( es & WS_EX_TOOLWINDOW ) ) or ( es & WS_EX_APPWINDOW ) ) { WinGetClass, class, ahk_id %wid% WinGetTitle, title, ahk_id %wid% text = %text%`n[%wid%, %class%] %title% } } MsgBox, %text% return