Explain the criteria for determining whether a window should be added to the taskbar or not.
```c
__int64 __fastcall ShouldAddWindowToTray(struct ITrayComponentHost *a1, HWND a2)
{
  unsigned int v4; // ebx
  char v5; // bp
  HWND v6; // rdx
  int v8; // [rsp+40h] [rbp+18h] BYREF

  v4 = 0;
  v8 = 0;
  if ( (unsigned int)GetWindowBand(a2, &v8) )
  {
    v5 = byte_1801BA484[8 * v8];
    if ( (GetPropW(a2, (LPCWSTR)0xA920) || v5)
      && (!(unsigned int)IsShellManagedWindow(a2)
       || ShellManagedWindowHelper::ShouldTreatShellManagedWindowAsNotShellManaged((ShellManagedWindowHelper *)a2, v6))
      && IsWindow(a2)
      && a2 != (HWND)(*(__int64 (__fastcall **)(struct ITrayComponentHost *))(*(_QWORD *)a1 + 656LL))(a1)
      && a2 != (HWND)(*(__int64 (__fastcall **)(struct ITrayComponentHost *))(*(_QWORD *)a1 + 664LL))(a1)
      && (GetClassWord(a2, -32) != g_SecondaryTaskbarAtom || !g_SecondaryTaskbarAtom) )
    {
      if ( IsWindowVisible(a2) )
        return ShouldAddWindowToTrayHelper(a2);
    }
  }
  return v4;
}
// 180040B50: variable 'v6' is possibly undefined
// 1801AE010: using guessed type __int64 __fastcall guard_dispatch_icall_thunk_10345483385596137414();
// 1801AF4A0: using guessed type __int64 __fastcall IsShellManagedWindow(_QWORD);
// 1801B0448: using guessed type __int64 __fastcall GetWindowBand(_QWORD, _QWORD);
// 1801BA484: using guessed type _BYTE byte_1801BA484[156];
// 18023288C: using guessed type unsigned __int16 g_SecondaryTaskbarAtom;

//----- (0000000180040B6C) ----------------------------------------------------
_BOOL8 __fastcall ShouldAddWindowToTrayHelper(HWND hWnd)
{
  LONG WindowLongW; // ebx

  if ( IsValidTabWindowForTray(hWnd)
    && ((WindowLongW = GetWindowLongW(hWnd, -20), !GetWindow(hWnd, 4u)) || (WindowLongW & 0x40000) != 0) )
  {
    return (WindowLongW & 0x80) == 0;
  }
  else
  {
    return 0LL;
  }
}

//----- (0000000180040BCC) ----------------------------------------------------
// Hidden C++ exception states: #wind=6
bool __fastcall IsValidTabWindowForTray(HWND hwnd)
{
  HANDLE PropW; // rsi
  WCHAR *v3; // rbx
  int v5; // eax
  PROPERTYKEY v6; // [rsp+30h] [rbp-20h] BYREF
  void *ppv; // [rsp+70h] [rbp+20h] BYREF
  PCWSTR pszItem; // [rsp+78h] [rbp+28h] BYREF
  __int64 v9; // [rsp+80h] [rbp+30h] BYREF

  if ( !hwnd )
    return 0;
  PropW = GetPropW(hwnd, (LPCWSTR)0xA920);
  ppv = 0LL;
  v3 = 0LL;
  pszItem = 0LL;
  if ( PropW )
  {
    ppv = 0LL;
    if ( SHGetPropertyStoreForWindow(hwnd, &GUID_886d8eeb_8cf2_4446_8d02_cdba1dbdcf99, &ppv) >= 0 )
    {
      wil::PropertyStoreHelper::PropertyStoreHelper((wil::PropertyStoreHelper *)&v9, (struct IPropertyStore *)ppv);
      v6 = PKEY_AppUserModel_ID;
      v5 = wil::PropertyStoreHelperBase<IPropertyStore>::GetString<_tagpropertykey>(&v9, (__int128 *)&v6, &pszItem);
      v3 = (WCHAR *)pszItem;
      if ( v5 >= 0 && pszItem )
      {
        pszItem = 0LL;
        if ( SHCreateItemInKnownFolder(
               &FOLDERID_AppsFolder,
               0x4000u,
               v3,
               &GUID_7e9fb0d3_919f_4307_ab2e_9b1860310c93,
               (void **)&pszItem) >= 0 )
        {
          wil::com_ptr_t<IPinnedList3,wil::err_exception_policy>::~com_ptr_t<IPinnedList3,wil::err_exception_policy>(&pszItem);
          Microsoft::WRL::ComPtr<IVirtualDesktopNotificationService>::InternalRelease(&v9);
          CoTaskMemFree(v3);
          wil::com_ptr_t<IDataObject,wil::err_exception_policy>::~com_ptr_t<IDataObject,wil::err_exception_policy>(&ppv);
          return 1;
        }
        wil::com_ptr_t<IPinnedList3,wil::err_exception_policy>::~com_ptr_t<IPinnedList3,wil::err_exception_policy>(&pszItem);
      }
      Microsoft::WRL::ComPtr<IVirtualDesktopNotificationService>::InternalRelease(&v9);
    }
  }
  CoTaskMemFree(v3);
  if ( ppv )
    (*(void (__fastcall **)(void *))(*(_QWORD *)ppv + 16LL))(ppv);
  return PropW == 0LL;
}
// 180044067: variable 'v5' is possibly undefined
// 1801AF4A0: using guessed type __int64 __fastcall IsShellManagedWindow(_QWORD);
// 1801B0448: using guessed type __int64 __fastcall GetWindowBand(_QWORD, _QWORD);
// 1801BA484: using guessed type _BYTE byte_1801BA484[156];

//----- (000000018004407C) ----------------------------------------------------
bool __fastcall ShellManagedWindowHelper::ShouldTreatShellManagedWindowAsNotShellManaged(
        ShellManagedWindowHelper *this,
        HWND a2)
{
  return GetPropW((HWND)this, L"Microsoft.Windows.ShellManagedWindowAsNormalWindow") != 0LL;
}
```