未验证 提交 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
/// <summary>
/// This function must be called first to validate use of other members.
/// </summary>
void HrInit();
[PreserveSig]
HRESULT HrInit();
/// <summary>
/// This function adds a tab for hwnd to the taskbar.
......
......@@ -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.
_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.
if (TraceShell.IsEnabled)
......@@ -6292,6 +6292,7 @@ private void ApplyTaskbarItemInfo()
return;
}
HRESULT hr = HRESULT.S_OK;
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.
......@@ -6304,12 +6305,19 @@ private void ApplyTaskbarItemInfo()
try
{
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.
_taskbarList = (ITaskbarList3)taskbarList;
taskbarList = null;
}
}
finally
{
Utilities.SafeRelease(ref taskbarList);
......@@ -6334,7 +6342,6 @@ private void ApplyTaskbarItemInfo()
}
// Apply (or clear) all aspects of the TaskbarItemInfo to this Window.
HRESULT hr = HRESULT.S_OK;
hr = RegisterTaskbarThumbButtons();
if (hr.Succeeded)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册