Hi.
I've got a program that sits on the desktop running all the time, and the app is displayed in the task tray. Is there a way to hide the task in the task band, but still have the program visible?
Matt
Task Tray App Display
Re: Task Tray App Display
I think removing the WS_EX_APPWINDOW extended style from your program's window should achieve this.
-
- Posts: 114
- Joined: Mon 16 Apr 2018, 06:17
Re: Task Tray App Display
Thanks Richard,
I have this code in the program and have added the two line containing the extended styles.
However, the taskbar still displays the program. Maybe this isn't what you meant, but I couldn't see any other meaning.
Matt
I have this code in the program and have added the two line containing the extended styles.
Code: Select all
SYS "GetWindowLong", @hwnd%, GWL_STYLE TO ws%
SYS "SetWindowLong", @hwnd%, GWL_STYLE, \
\ ws% AND NOT WS_THICKFRAME AND NOT WS_MAXIMIZEBOX AND NOT WS_BORDER
SYS "GetWindowLong", @hwnd%, GWL_EXSTYLE TO ws%
SYS "SetWindowLong", @hwnd%, GWL_EXSTYLE, \
\ ws% AND NOT WS_EX_APPWINDOW
SYS "SetWindowPos", @hwnd%, HWND_TOPMOST, WinXpos%, WinYpos%, 300, 300, 0
Matt
Re: Task Tray App Display
Yes, it's what I meant, but I only got it from Google (as you could have), it's not something that I have any personal experience of. Searching Raymond Chen's blog (as close to 'from the horse's mouth' as you can get with Microsoft) he says this of the icon in the taskbar:
- If the WS_EX_APPWINDOW extended style is set, then it will show (when visible).
- If the window is a top-level unowned window, then it will show (when visible).
- Otherwise it doesn’t show.
Re: Task Tray App Display
This may not be an acceptable solution in your application, but if you don't mind your main window having the WS_EX_TOOLWINDOW style (which has the effect of removing the maximize and minimize buttons in the title bar, and making the close button smaller) that will hide the taskbar icon:
You can still minimize or maximize the window by right-clicking on the title bar (or typing Alt+Space) and selecting from the menu, but of course minimizing a window with no taskbar icon is not a great idea!
Code: Select all
GWL_EXSTYLE = -20
SW_HIDE = 0
SW_SHOW = 5
WS_EX_APPWINDOW = &40000
WS_EX_TOOLWINDOW = &80
SYS "ShowWindow", @hwnd%, SW_HIDE
SYS "GetWindowLong", @hwnd%, GWL_EXSTYLE TO ws%
SYS "SetWindowLong", @hwnd%, GWL_EXSTYLE, ws% AND NOT WS_EX_APPWINDOW OR WS_EX_TOOLWINDOW
SYS "ShowWindow", @hwnd%, SW_SHOW
REPEAT : WAIT 2 : UNTIL FALSE
-
- Posts: 114
- Joined: Mon 16 Apr 2018, 06:17
Re: Task Tray App Display
Thanks Richard,
This is exactly what I needed. I had read the descriptions of the EX codes, but had missed the possibility of this one. It works a treat. It shows that sometimes you have to look outside the box. It also forced me into noticing several other mistakes I'd made in other areas of the code that were transparent without this.
Matt
This is exactly what I needed. I had read the descriptions of the EX codes, but had missed the possibility of this one. It works a treat. It shows that sometimes you have to look outside the box. It also forced me into noticing several other mistakes I'd made in other areas of the code that were transparent without this.
Matt