diff --git a/PInvoke/Ole/Ole32/WTypes.PROPERTYKEY.cs b/PInvoke/Ole/Ole32/WTypes.PROPERTYKEY.cs index bb74bbc6..552ff7bc 100644 --- a/PInvoke/Ole/Ole32/WTypes.PROPERTYKEY.cs +++ b/PInvoke/Ole/Ole32/WTypes.PROPERTYKEY.cs @@ -85,6 +85,14 @@ public static partial class Ole32 pid = id; } + /// Initializes a new instance of the struct using a canonical property name. + /// Name of the canonical. + public PROPERTYKEY(string canonicalName) + { + PropSys.PSGetPropertyKeyFromName(canonicalName, out var pk).ThrowIfFailed(); + this = pk; + } + /// A unique GUID for the property. public readonly Guid Key => fmtid; @@ -100,6 +108,13 @@ public static partial class Ole32 /// public override string ToString() => GetCanonicalName() ?? ReverseLookup(this) ?? $"{Key:B} {Id}"; + /// Converts the value to the canonical value, according to the property description. + /// + /// On entry, contains a pointer to a PROPVARIANT structure that contains the original value. When this function returns + /// successfully, contains the canonical value. + /// + public void CoerceToCanonicalValue(PROPVARIANT value) => PropSys.PSCoerceToCanonicalValue(this, value).ThrowIfFailed(); + /// public override bool Equals(object? obj) => obj is PROPERTYKEY other && Equals(other);