Posts: 1,271
Threads: 399
Joined: Mar 2003
is it possible to remove a window from the window taskbar without hiding
the window itself ?
thanks
Posts: 12,097
Threads: 142
Joined: Dec 2002
;/
function action hwnd ;;action: 1 add, 2 delete
;Adds or deletes taksbar button for window whose handle is hwnd.
interface# ITaskbarList :IUnknown
,HrInit()
,AddTab(hwnd)
,DeleteTab(hwnd)
,ActivateTab(hwnd)
,SetActiveAlt(hwnd)
,{56FDF342-FD6D-11d0-958A-006097C9A090}
ITaskbarList t._create("{56FDF344-FD6D-11D0-958A-006097C9A090}")
t.HrInit
sel action
,case 1 t.AddTab(hwnd)
,case 2 t.DeleteTab(hwnd)
err end _error
Posts: 1,271
Threads: 399
Joined: Mar 2003
Posts: 1,271
Threads: 399
Joined: Mar 2003
whenever a deleted window is activated it will show up in the taskbar again.
do i have to use an 'activated window hook' or' do you know a way
to hide the taskbar button permantly.
Posts: 12,097
Threads: 142
Joined: Dec 2002
Use hook or trigger.
Or try this:
SetWindowLong(hwnd GWL_HWNDPARENT GetDesktopWindow)
This removes the taskbar button even without ModifyTaskbar.
Owned windows are not added to taskbar, unless have WS_EX_APPWINDOW exstyle, which can be removed with SetWinStyle.
SetWindowLong(hwnd GWL_HWNDPARENT 0)
will add taskbar button.
Also check if the window is already owned. If yes, just remove WS_EX_APPWINDOW without changing owner. To check it, use if(GetWindow(hwnd GW_OWNER)).
Posts: 12,097
Threads: 142
Joined: Dec 2002
Function TaskbarButton
;/
function action hwnd ;;action: 1 add (only if removed), 2 remove
;Deletes or adds (if deleted using this function) taskbar button for window whose handle is hwnd.
int fl
sel action
,case 2
,if(!GetWindow(hwnd GW_OWNER))
,,fl|1
,,SetWindowLong(hwnd GWL_HWNDPARENT GetDesktopWindow)
,if(GetWinStyle(hwnd 1)&WS_EX_APPWINDOW)
,,fl|2
,,SetWinStyle hwnd WS_EX_APPWINDOW 6
,if(fl) SetProp(hwnd "qm_tb_flags" fl)
,
,case 1
,fl=GetProp(hwnd "qm_tb_flags")
,if(fl&1)
,,SetWindowLong(hwnd GWL_HWNDPARENT 0)
,if(fl&2)
,,SetWinStyle hwnd WS_EX_APPWINDOW 5
,RemoveProp hwnd "qm_tb_flags"
Test code
int hwnd=win("Notepad") ;;unowned
;int hwnd=win("QM - Threads") ;;owned with WS_EX_APPWINDOW exstyle
TaskbarButton 2 hwnd
3
TaskbarButton 1 hwnd
Posts: 1,271
Threads: 399
Joined: Mar 2003
perfect !!!!
i trigger it with middle click on taskbar button.
function name: middleclick
trigger: #Mh1 //middleclick
;\
function# iid FILTER&f
ClearOutput
str cla.getwinclass(f.hwnd)
str childclass.getwinclass(f.hwnd2)
if(!f.hwnd2) ret -2
sel _s.getwinexe(f.hwnd) 1
,case "explorer"
,,;out childclass
,,;if(wintest(f.hwnd "" "ExploreWClass")) mac "explorer_get_file"
,,;if(wintest(f.hwnd "" "Progman")) mac "desktop"
,,if(wintest(f.hwnd "" "Shell_TrayWnd"))
,,,;if(childtest(f.hwnd2 "Quick Launch" "ToolbarWindow32" f.hwnd))
,,,,;Acc a=acc(mouse); err ret
,,,,;if(!a.elem) ret ;;not on button
,,,,;str s=a.Name
,,,,;mac "quicklaunch" s
,,,,;ret -1
,,,if(childtest(f.hwnd2 "Ausgeführte Anwendungen" "ToolbarWindow32" f.hwnd))
,,,,Acc a=acc(mouse); err ret
,,,,if(!a.elem) ret ;;not on button
,,,,int mhwnd=win(a.Name)
,,,,TaskbarButton 2 mhwnd
,,,,ret -1
,,
,case "qm"
,,if(wintest(f.hwnd "" "QM_Editor"))
,,,sel GetWinId(f.hwnd2)
,,,,case 2202 mac "qm2202"
,,,,case 2201 ClearOutput
,,,,case 2203 mac "qm_find"
,,,,case 2200 mac "qm_macro_trigger"
,,if _s.getwinclass(f.hwnd)="HH Parent"
,,,mac "_help"
,,if(wintest(f.hwnd "Find"))
,,,mac "get_macroname"
,,if(wintest(f.hwnd "" "QM_toolbar"))
,,,if(_s.getwintext(f.hwnd)=="DESKBAR")
,,,,mac "qm_deskbar_middle"
,,,;if(_s.getwintext(f.hwnd)=="BBCODE_BAR")
,,,,;_bbcode(2)
,case else ret -2 ;;default action in other programs
Posts: 1,271
Threads: 399
Joined: Mar 2003
in windows 7 it does not work.
do you have an idea why?
Posts: 12,097
Threads: 142
Joined: Dec 2002
int hwnd=win("Notepad") ;;unowned
;int hwnd=win("QM - Threads") ;;owned with WS_EX_APPWINDOW exstyle
TaskbarButton 2 hwnd
3
TaskbarButton 1 hwnd
Tested on 64 bit beta, worked.
Posts: 1,271
Threads: 399
Joined: Mar 2003
05-25-2020, 05:14 PM
(This post was last modified: 05-25-2020, 05:18 PM by _pi.)
Do you have an idea how to do that with UWP apps in Windows 10?
I tried it with Calc (german: Rechner)
I did some research and from what i can find it seems not be supported, but you so often know more.
https://stackoverflow.com/questions/4678...6#46828926
Function Hide_Calc_Taskbar_Button
int w=win("Rechner" "ApplicationFrameWindow")
TaskbarButton 2 w
3
TaskbarButton 1 w
|