未验证 提交 c308dfca 编写于 作者: J Jan Kučera 提交者: GitHub

Ignore NotImplementedException from ITaskbarList (#6547)

Co-authored-by: NJan Kučera <miloush@users.noreply.github.com>
上级 b296f3bf
...@@ -697,7 +697,8 @@ internal interface ITaskbarList ...@@ -697,7 +697,8 @@ internal interface ITaskbarList
/// <summary> /// <summary>
/// This function must be called first to validate use of other members. /// This function must be called first to validate use of other members.
/// </summary> /// </summary>
void HrInit(); [PreserveSig]
HRESULT HrInit();
/// <summary> /// <summary>
/// This function adds a tab for hwnd to the taskbar. /// This function adds a tab for hwnd to the taskbar.
......
...@@ -637,7 +637,7 @@ private void HandleTaskbarListError(HRESULT hr) ...@@ -637,7 +637,7 @@ private void HandleTaskbarListError(HRESULT hr)
// Explorer being non-responsive should be a transient issue. Post back to apply the full TaskbarItemInfo. // Explorer being non-responsive should be a transient issue. Post back to apply the full TaskbarItemInfo.
_taskbarRetryTimer.Start(); _taskbarRetryTimer.Start();
} }
else if (hr == (HRESULT)Win32Error.ERROR_INVALID_WINDOW_HANDLE) else if (hr == (HRESULT)Win32Error.ERROR_INVALID_WINDOW_HANDLE || hr == HRESULT.E_NOTIMPL)
{ {
// We'll get this when Explorer's not running. This means there's no Shell to integrate with. // We'll get this when Explorer's not running. This means there's no Shell to integrate with.
if (TraceShell.IsEnabled) if (TraceShell.IsEnabled)
...@@ -6292,6 +6292,7 @@ private void ApplyTaskbarItemInfo() ...@@ -6292,6 +6292,7 @@ private void ApplyTaskbarItemInfo()
return; return;
} }
HRESULT hr = HRESULT.S_OK;
if (_taskbarList == null) if (_taskbarList == null)
{ {
// If we don't have a handle and there isn't a TaskbarItemInfo, then we don't have anything to apply or remove. // If we don't have a handle and there isn't a TaskbarItemInfo, then we don't have anything to apply or remove.
...@@ -6304,12 +6305,19 @@ private void ApplyTaskbarItemInfo() ...@@ -6304,12 +6305,19 @@ private void ApplyTaskbarItemInfo()
try try
{ {
taskbarList = (ITaskbarList)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(CLSID.TaskbarList))); taskbarList = (ITaskbarList)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(CLSID.TaskbarList)));
taskbarList.HrInit();
hr = taskbarList.HrInit();
if (hr != HRESULT.S_OK)
{
// Taskbar not available (no user logged in, running under terminal service, custom shell, etc.)
HandleTaskbarListError(hr);
return;
}
// This QI will only work on Win7. // This QI will only work on Win7.
_taskbarList = (ITaskbarList3)taskbarList; _taskbarList = (ITaskbarList3)taskbarList;
taskbarList = null; taskbarList = null;
} }
finally finally
{ {
Utilities.SafeRelease(ref taskbarList); Utilities.SafeRelease(ref taskbarList);
...@@ -6334,7 +6342,6 @@ private void ApplyTaskbarItemInfo() ...@@ -6334,7 +6342,6 @@ private void ApplyTaskbarItemInfo()
} }
// Apply (or clear) all aspects of the TaskbarItemInfo to this Window. // Apply (or clear) all aspects of the TaskbarItemInfo to this Window.
HRESULT hr = HRESULT.S_OK;
hr = RegisterTaskbarThumbButtons(); hr = RegisterTaskbarThumbButtons();
if (hr.Succeeded) if (hr.Succeeded)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册