-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break StandardDispatch into a base class with a derived generic.
This will allow using StandardDispatch for dynamic scenarios where there is no preknown interface (i.e. found via ITypeInfo at runtime).
- Loading branch information
1 parent
52d0afc
commit 485f249
Showing
2 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Jeremy W. Kuhne. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Windows.Win32.System.Com; | ||
|
||
/// <summary> | ||
/// Base class for providing <see cref="IDispatch"/> services around an existing <see cref="ITypeInfo"/> for a | ||
/// given <typeparamref name="T"/>. | ||
/// </summary> | ||
public unsafe abstract class StandardDispatch<T> : StandardDispatch | ||
where T : unmanaged, IComIID | ||
{ | ||
public StandardDispatch(ITypeInfo* typeInfo) : base(typeInfo, T.Guid) | ||
{ | ||
} | ||
|
||
protected override ComScope GetComCallableWrapper() => new(ComHelpers.GetComPointer<T>(this)); | ||
} |