Browse Source
Handle case when TaskBarList could not be created (#15852)
* Handle case when TaskBarList could not be created
* Use HRESULT.S_OK for better clarity
pull/15870/head
József Molnár
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
0 deletions
-
src/Windows/Avalonia.Win32/Interop/TaskBarList.cs
|
|
@ -19,6 +19,11 @@ namespace Avalonia.Win32.Interop |
|
|
{ |
|
|
{ |
|
|
int result = CoCreateInstance(in ShellIds.TaskBarList, IntPtr.Zero, 1, in ShellIds.ITaskBarList2, out IntPtr instance); |
|
|
int result = CoCreateInstance(in ShellIds.TaskBarList, IntPtr.Zero, 1, in ShellIds.ITaskBarList2, out IntPtr instance); |
|
|
|
|
|
|
|
|
|
|
|
if (result != (int)HRESULT.S_OK) |
|
|
|
|
|
{ |
|
|
|
|
|
return IntPtr.Zero; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var ptr = (ITaskBarList3VTable**)instance.ToPointer(); |
|
|
var ptr = (ITaskBarList3VTable**)instance.ToPointer(); |
|
|
|
|
|
|
|
|
s_hrInitDelegate ??= Marshal.GetDelegateForFunctionPointer<HrInit>((*ptr)->HrInit); |
|
|
s_hrInitDelegate ??= Marshal.GetDelegateForFunctionPointer<HrInit>((*ptr)->HrInit); |
|
|
|