# Hide App button from TaskBar when it goes to Systray icon

**URL:** <https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517>\
**Category:** questions\
**Tags:** winapi\
**Created:** [August 24, 2025, 10:40am UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517 "2025-08-24T10:40:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [August 24, 2025, 10:40am UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/1 "2025-08-24T10:40:36Z")

</div>

I'm trying to hide an App Button from the taskbar when I create a systray icon for it, but it keeps reappearing. Having to roll my own code to replace the FrameExtension template/class.

Anyone know why?

```clarion
SysTrayAddTrayIcon Procedure()

    Code
    Loc:SysTrayIcon = 'pcWTApp_ico'

    Loc:TrayIcon.cbSize = Size(Loc:TrayIcon)
    Loc:TrayIcon.hWnd = MF:Handle
    Loc:TrayIcon.uID = 1 ! The application-defined identifier of the taskbar icon. The Shell uses either (hWnd plus uID
    Loc:TrayIcon.uFlags = 0 ! Flags that either indicate which of the other members of the structure contain valid data or provide additional information to the tooltip as to how it should display
    Loc:TrayIcon.uFlags += ISEQ:NOTIFYICONDATAA:NIF_Message
    Loc:TrayIcon.uFlags += ISEQ:NOTIFYICONDATAA:NIF_Icon
    Loc:TrayIcon.uFlags += ISEQ:NOTIFYICONDATAA:NIF_Tip

    Loc:TrayIcon.uCallbackMessage = UserEvent:SysTrayEvents ! An application-defined message identifier. The system uses this identifier to send notification messages to the window identified in hWnd.
    Loc:TrayIcon.hIcon = ISWA_LoadImage( System{PROP:AppInstance}, Address(Loc:SysTrayIcon),1,16,16,0)
    Loc:TrayIcon.szTip = 'pcWorkTime' ! A null-terminated string that specifies the text for a standard tooltip. It can have a maximum of 64 characters,

    ISWA_Shell_NotifyIconA( ISEQ:SysTray:NIM_ADD, Address(Loc:TrayIcon) ) ! Adds an icon to the SysTray

! !ISWA_ShowWindow(MF:Handle, ISEQ:Window:SW_HIDE ) ! Hide the MainFrame
! !ISWA_ShowWindow(MF:Handle, ISEQ:Window:SW_HIDE )
! AppFrame{Prop:Hide} = True
! AppFrame{PROP:Active} = False

```

The 4 commented out lines, hide the taskbar button, but it keeps reappearing. The MS docs state

> This parameter is ignored the first time an application calls **ShowWindow** , if the program that launched the application provides a [STARTUPINFO](https://learn.microsoft.com/en-us/windows/desktop/api/processthreadsapi/ns-processthreadsapi-startupinfoa) structure. Otherwise, the first time **ShowWindow** is called, the value should be the value obtained by the [WinMain](https://learn.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-winmain) function in its _nCmdShow_ parameter.

which is why ShowWindow() is listed twice.

TIA

---

<div class="post-metadata">

**Author:** ![m.losinno](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/958977/32.png) [@m.losinno](https://clarionhub.com/u/m.losinno)\
**Post date:** [August 28, 2025, 1:18pm UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/2 "2025-08-28T13:18:44Z")

</div>

> [@RchdR](#):
>
> This parameter is ignored the first time an application calls **ShowWindow** , if the program that launched the application provides a [STARTUPINFO](https://learn.microsoft.com/en-us/windows/desktop/api/processthreadsapi/ns-processthreadsapi-startupinfoa) structure. Otherwise, the first time **ShowWindow** is called, the value should be the value obtained by the [WinMain](https://learn.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-winmain) function in its _nCmdShow_ parameter.

Maybe not the prettiest solution, but it works.  
You should remove the WS\_EX\_TOOLWINDOW style again when removing it from the tray.

```auto
      lError = Shell_NotifyIcon(NIM_ADD,ADDRESS(gNotifyIconData))
      ShowWindow(wTest{Prop:Handle},SW_HIDE)
      lStyle = GetWindowLong(wTest{PROP:Handle}, GWL_EXSTYLE)
      lStyle = BOR(lStyle, WS_EX_TOOLWINDOW)
      ret# = SetWindowLong(wTest{PROP:Handle}, GWL_EXSTYLE, lStyle)
      ShowWindow(wTest{Prop:Handle},SW_SHOW)

```

Hope it helps…

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [August 28, 2025, 4:08pm UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/3 "2025-08-28T16:08:10Z")

</div>

I had most of the code in place, as shown here : [Using a small pop-up window for Find or similar - #9 by RchdR](https://clarionhub.com/t/using-a-small-pop-up-window-for-find-or-similar/8536/9)

The problem at the time was the mainframe window was also appearing, I’ve since fixed that now, but just trying to change the default Clarion triangle icon that appears on the taskbar button.

 ![Screenshot 2025-08-28 170545](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/9/9ceb5e05ee39c6f196f8f62a8282c94fc6d96dba.png)

---

<div class="post-metadata">

**Author:** ![m.losinno](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/958977/32.png) [@m.losinno](https://clarionhub.com/u/m.losinno)\
**Post date:** [August 28, 2025, 6:44pm UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/4 "2025-08-28T18:44:41Z")

</div>

> [@RchdR](#):
>
> The problem at the time was the mainframe window was also appearing, I’ve since fixed that now, but just trying to change the default Clarion triangle icon that appears on the taskbar button

SYSTEM{PROP:ICON} doesn’t work?

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [August 28, 2025, 6:51pm UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/5 "2025-08-28T18:51:45Z")

</div>

Sadly no, but I’m investigating the windows classes at the moment.

---

<div class="post-metadata">

**Author:** ![m.losinno](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/958977/32.png) [@m.losinno](https://clarionhub.com/u/m.losinno)\
**Post date:** [August 28, 2025, 7:06pm UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/6 "2025-08-28T19:06:31Z")

</div>

And what about setting the icon in the window and disable the system buttons? Or trying to hide them?

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [August 28, 2025, 8:37pm UTC](https://clarionhub.com/t/hide-app-button-from-taskbar-when-it-goes-to-systray-icon/8517/7 "2025-08-28T20:37:43Z")

</div>

It doesnt work once I remove the Owner. I need to do this, to get the window to appear on the taskbar as a button to its own standalone window.
