diff --git a/Core/Extensions/InteropExtensions.cs b/Core/Extensions/InteropExtensions.cs
index 5d782cd4..2533275d 100644
--- a/Core/Extensions/InteropExtensions.cs
+++ b/Core/Extensions/InteropExtensions.cs
@@ -195,6 +195,19 @@ namespace Vanara.Extensions
/// A new pointer that reflects the addition of to .
public static IntPtr Offset(this IntPtr pointer, long offset) => new IntPtr(pointer.ToInt64() + offset);
+ /// Queries the object for a COM interface and returns it, if found, in .
+ /// The object to query.
+ /// The interface identifier (IID) of the requested interface.
+ /// When this method returns, contains a reference to the returned interface.
+ /// An HRESULT that indicates the success or failure of the call.
+ public static int QueryInterface(object iUnk, in Guid iid, out object ppv)
+ {
+ var tmp = iid;
+ var hr = Marshal.QueryInterface(Marshal.GetIUnknownForObject(iUnk), ref tmp, out var ippv);
+ ppv = hr == 0 ? Marshal.GetObjectForIUnknown(ippv) : null;
+ return hr;
+ }
+
/// Marshals data from a managed object to an unmanaged block of memory that is allocated using .
/// The type of the managed object.
///