diff --git a/PInvoke/Ole/PropSys/PropSys.PropertyBag.cs b/PInvoke/Ole/PropSys/PropSys.PropertyBag.cs new file mode 100644 index 00000000..8af83ff7 --- /dev/null +++ b/PInvoke/Ole/PropSys/PropSys.PropertyBag.cs @@ -0,0 +1,1072 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Text; +using Vanara.InteropServices; +using static Vanara.PInvoke.Ole32; + +namespace Vanara.PInvoke +{ + public static partial class PropSys + { + /// + /// Deletes a property from a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_delete PSSTDAPI PSPropertyBag_Delete( + // IPropertyBag *propBag, LPCWSTR propName ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "53ED1C87-5141-4925-B70E-C0304817A871")] + public static extern HRESULT PSPropertyBag_Delete(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName); + + /// + /// Reads the BOOL data value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: BOOL* + /// When this function returns successfully, contains a pointer to the value read from the property. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between windows types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readbool PSSTDAPI PSPropertyBag_ReadBOOL( + // IPropertyBag *propBag, LPCWSTR propName, BOOL *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "95F9CB5E-E690-4d83-A094-02981F0578CF")] + public static extern HRESULT PSPropertyBag_ReadBOOL(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.Bool)] out bool value); + + /// + /// Reads a BSTR data value from a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: BSTR* + /// When this function returns, contains a pointer to a BSTR property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readbstr PSSTDAPI PSPropertyBag_ReadBSTR( + // IPropertyBag *propBag, LPCWSTR propName, BSTR *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "14F21A4D-4867-4c4d-9BD8-C733B1C50266")] + public static extern HRESULT PSPropertyBag_ReadBSTR(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.BStr)] out string value); + + /// + /// Reads a DWORD data value from property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated property name string. + /// + /// + /// Type: DWORD* + /// When this function returns, contains a pointer to a DWORD property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readdword PSSTDAPI PSPropertyBag_ReadDWORD( + // IPropertyBag *propBag, LPCWSTR propName, DWORD *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "31977E3F-FA2F-4c2d-8A95-6BF937EDC45C")] + public static extern HRESULT PSPropertyBag_ReadDWORD(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out uint value); + + /// + /// Reads the GUID data value from a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: GUID* + /// When this function returns, contains a pointer to a GUID property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readguid PSSTDAPI PSPropertyBag_ReadGUID( + // IPropertyBag *propBag, LPCWSTR propName, GUID *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "BCC6E830-CF05-42c1-874F-CCC97E58A4BC")] + public static extern HRESULT PSPropertyBag_ReadGUID(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out Guid value); + + /// + /// Reads an int data value from a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: int* + /// When this function returns, contains a pointer to an int property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// If the property bag does not already contain the specified property, the call still succeeds. + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readint PSSTDAPI PSPropertyBag_ReadInt( + // IPropertyBag *propBag, LPCWSTR propName, INT *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "9CEC97E6-C88F-4182-876C-D77EA14915DA")] + public static extern HRESULT PSPropertyBag_ReadInt(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out int value); + + /// + /// Reads a LONG data value from a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: LONG* + /// When this function returns, contains a pointer to a LONG property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// If the property bag does not already contain the specified property, the call still succeeds. + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readlong PSSTDAPI PSPropertyBag_ReadLONG( + // IPropertyBag *propBag, LPCWSTR propName, LONG *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "A39E1F7C-A4FB-47da-A05E-39F6176F2878")] + public static extern HRESULT PSPropertyBag_ReadLONG(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out int value); + + /// + /// Retrieves the property coordinates stored in a POINTL structure of a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: POINTL* + /// When this function returns, contains a pointer to a POINTL structure that contains the property coordinates. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readpointl PSSTDAPI + // PSPropertyBag_ReadPOINTL( IPropertyBag *propBag, LPCWSTR propName, POINTL *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "B8F66DF9-A366-41a7-8311-B9E1CDE14ADB")] + public static extern HRESULT PSPropertyBag_ReadPOINTL(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out Point value); + + /// + /// Retrieves the property coordinates stored in a POINTS structure of a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: POINTS* + /// When this function returns successfully, contains a pointer to a POINTS structure that contains the property coordinates. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readpoints PSSTDAPI + // PSPropertyBag_ReadPOINTS( IPropertyBag *propBag, LPCWSTR propName, POINTS *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "60ED145A-7712-43b7-A2AD-C366DD32E19E")] + public static extern HRESULT PSPropertyBag_ReadPOINTS(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out POINTS value); + + /// + /// Reads the property key of a property in a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: PROPERTYKEY* + /// When this function returns, contains a pointer to a property key value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readpropertykey PSSTDAPI + // PSPropertyBag_ReadPropertyKey( IPropertyBag *propBag, LPCWSTR propName, PROPERTYKEY *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "910D1356-DC61-470b-90BB-0DCF1B861E05")] + public static extern HRESULT PSPropertyBag_ReadPropertyKey(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out PROPERTYKEY value); + + /// + /// Retrieves the coordinates of a rectangle stored in a property contained in a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: RECTL* + /// When this function returns, contains a pointer to a RECTL structure that contains the property coordinates. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readrectl PSSTDAPI PSPropertyBag_ReadRECTL( + // IPropertyBag *propBag, LPCWSTR propName, RECTL *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "4DAABF63-7CBA-4361-9E58-7072869CFDEC")] + public static extern HRESULT PSPropertyBag_ReadRECTL(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out RECT value); + + /// + /// Reads the SHORT data value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: SHORT* + /// When this function returns, contains a pointer to a SHORT property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readshort PSSTDAPI PSPropertyBag_ReadSHORT( + // IPropertyBag *propBag, LPCWSTR propName, SHORT *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "F6E71602-86D0-41be-854F-83C5D5B64BF8")] + public static extern HRESULT PSPropertyBag_ReadSHORT(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out short value); + + /// + /// Reads the string data value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: LPCWSTR + /// When this function returns, contains a pointer to a string property value. + /// + /// + /// Type: int + /// + /// This function returns the integer that represents the size (maximum number of characters) of the value parameter being returned. + /// + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readstr PSSTDAPI PSPropertyBag_ReadStr( + // IPropertyBag *propBag, LPCWSTR propName, LPWSTR value, int characterCount ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "2E3E86D6-B070-49fc-AAF0-D6DCF0EA16B7")] + public static extern HRESULT PSPropertyBag_ReadStr(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder value, int characterCount); + + /// + /// Reads a string data value from a property in a property bag and allocates memory for the string that is read. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated property name string. + /// + /// + /// Type: PWSTR* + /// + /// When this function returns, contains a pointer to a string data value from a property in a property bag and allocates memory for + /// the string that is read. The caller of the PSPropertyBag_ReadStrAlloc function needs to call a CoTaskMemFree function on this parameter. + /// + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readstralloc PSSTDAPI + // PSPropertyBag_ReadStrAlloc( IPropertyBag *propBag, LPCWSTR propName, PWSTR *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "2F58A6DB-3563-42fa-9B6F-327D0A87AE81")] + public static extern HRESULT PSPropertyBag_ReadStrAlloc(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CoTaskMemStringMarshaler))] out string value); + + /// + /// Reads the data stream stored in a given property contained in a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object, that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated property name string. + /// + /// + /// Type: IStream** + /// The address of a pointer that, when this function returns successfully, receives the IStream object. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The caller of the PSPropertyBag_ReadStream function needs to call a IUnknown::Release method on the IStream object returned by + /// this function. + /// + /// + /// IPropertyBag and IPersistPropertyBag optimize Save As Text functionality. IPropertyBag and IPropertyBag2 provide an object + /// with a property bag in which the object can save its properties persistently. IPropertyBag2 allows the object to obtain + /// type information for each property: IPropertyBag2::Read causes one or more properties to be read from the property bag, and + /// IPropertyBag2::Write causes one or more properties to be saved into the property bag. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readstream PSSTDAPI + // PSPropertyBag_ReadStream( IPropertyBag *propBag, LPCWSTR propName, IStream **value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "3D1D8B3E-DD16-4b34-918C-C8478EBF0930")] + public static extern HRESULT PSPropertyBag_ReadStream(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out IStream value); + + /// + /// Reads the type of data value of a property that is stored in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object, that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated property name string. + /// + /// + /// Type: VARIANT* + /// Returns on successful function completion a pointer to a VARIANT data type that contains the property value. + /// + /// + /// Type: VARTYPE* + /// + /// If type is VT_EMPTY, this function reads the VARIANT of the property in the IPropertyBag propBag parameter. If type is not + /// VT_EMPTY and not the same as the VARIANT read, then this function attempts to convert the VARIANT read to the + /// VARTYPE defined by type parameter before returning. + /// + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// IPropertyBag and IPersistPropertyBag optimize Save As Text functionality. IPropertyBag and IPropertyBag2 provide an object + /// with a property bag in which the object can save its properties persistently. IPropertyBag2 allows the object to obtain + /// type information for each property: IPropertyBag2::Read causes one or more properties to be read from the property bag, and + /// IPropertyBag2::Write causes one or more properties to be saved into the property bag. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readtype PSSTDAPI PSPropertyBag_ReadType( + // IPropertyBag *propBag, LPCWSTR propName, VARIANT *var, VARTYPE type ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "826038F7-FD93-474e-BCA7-910E214F3E01")] + public static extern HRESULT PSPropertyBag_ReadType(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out object var, VARTYPE type); + + /// + /// Reads a ULONGLONG data value from a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: ULONGLONG + /// When this function returns, contains a pointer to a ULONGLONG property value. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readulonglong PSSTDAPI + // PSPropertyBag_ReadULONGLONG( IPropertyBag *propBag, LPCWSTR propName, ULONGLONG *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "6DB59A95-D571-452b-8974-76B4CC3FA36F")] + public static extern HRESULT PSPropertyBag_ReadULONGLONG(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, out ulong value); + + /// + /// Reads a given property of an unknown data value in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object, that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated property name string. + /// + /// + /// Type: REFIID + /// + /// A reference to the IID of the interface to retrieve through ppv. This interface IID should be IPropertyBag or an interface + /// derived from IPropertyBag. + /// + /// + /// + /// Type: void** + /// When this method returns successfully, contains the interface pointer requested in riid. This is typically riid. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// IPropertyBag and IPersistPropertyBag optimize Save As Text functionality. IPropertyBag and IPropertyBag2 provide an object + /// with a property bag in which the object can save its properties persistently. IPropertyBag2 allows the object to obtain + /// type information for each property: IPropertyBag2::Read causes one or more properties to be read from the property bag, and + /// IPropertyBag2::Write causes one or more properties to be saved into the property bag. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_readunknown PSSTDAPI + // PSPropertyBag_ReadUnknown( IPropertyBag *propBag, LPCWSTR propName, REFIID riid, void **ppv ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "87921F52-308F-4ed7-8390-A3C0217ACEFD")] + public static extern HRESULT PSPropertyBag_ReadUnknown(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv); + + /// + /// Sets the BOOL value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: BOOL + /// The BOOL value to which the named property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writebool PSSTDAPI PSPropertyBag_WriteBOOL( + // IPropertyBag *propBag, LPCWSTR propName, BOOL value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "3703A7C4-CFDC-4453-AA8F-6A5D6B7D3E66")] + public static extern HRESULT PSPropertyBag_WriteBOOL(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.Bool)] bool value); + + /// + /// Sets the BSTR value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: BSTR + /// The BSTR value to which the named property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writebstr PSSTDAPI PSPropertyBag_WriteBSTR( + // IPropertyBag *propBag, LPCWSTR propName, BSTR value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "9C2DBD1F-6760-4812-A33E-9A71C5A421A9")] + public static extern HRESULT PSPropertyBag_WriteBSTR(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.BStr)] string value); + + /// + /// Sets the DWORD value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: DWORD + /// A DWORD value to which the named property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writedword PSSTDAPI + // PSPropertyBag_WriteDWORD( IPropertyBag *propBag, LPCWSTR propName, DWORD value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "59142C21-032F-462c-B4A7-337483917ABC")] + public static extern HRESULT PSPropertyBag_WriteDWORD(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, uint value); + + /// + /// Sets the GUID value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: const GUID* + /// A pointer to a GUID value to which the named property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writeguid PSSTDAPI PSPropertyBag_WriteGUID( + // IPropertyBag *propBag, LPCWSTR propName, const GUID *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "F50CF010-3A4E-4723-BA9F-CE1B48CA4AA4")] + public static extern HRESULT PSPropertyBag_WriteGUID(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [In, MarshalAs(UnmanagedType.LPStruct)] Guid value); + + /// + /// Sets the int value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: int + /// The int value to which the property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writeint PSSTDAPI PSPropertyBag_WriteInt( + // IPropertyBag *propBag, LPCWSTR propName, INT value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "1FCC59B1-5084-4981-8F1D-A5860744F221")] + public static extern HRESULT PSPropertyBag_WriteInt(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, int value); + + /// + /// Sets the LONG value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: LONG + /// The LONG value to which the property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writelong PSSTDAPI PSPropertyBag_WriteLONG( + // IPropertyBag *propBag, LPCWSTR propName, LONG value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "A623D097-FEF8-4864-A80A-C6EF824EC245")] + public static extern HRESULT PSPropertyBag_WriteLONG(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, int value); + + /// + /// Stores the property coordinates in aPOINTL structure of a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: const POINTL* + /// A pointer to a POINTL structure that specifies the coordinates to store in the property. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writepointl PSSTDAPI + // PSPropertyBag_WritePOINTL( IPropertyBag *propBag, LPCWSTR propName, const POINTL *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "881A9D35-DF77-44d1-86DF-D6BC97AC0DD4")] + public static extern HRESULT PSPropertyBag_WritePOINTL(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [In, MarshalAs(UnmanagedType.LPStruct)] Point value); + + /// + /// Stores the property coordinates in aPOINTS structure of a specified property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: const POINTS* + /// Pointer to a POINTS structure that specifies the coordinates to store in the property. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writepoints PSSTDAPI + // PSPropertyBag_WritePOINTS( IPropertyBag *propBag, LPCWSTR propName, const POINTS *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "B1E3E061-042A-4ba0-98F2-EA8A022882CC")] + public static extern HRESULT PSPropertyBag_WritePOINTS(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [In, MarshalAs(UnmanagedType.LPStruct)] POINTS value); + + /// + /// Sets the property key value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: REFPROPERTYKEY + /// A PROPERTYKEY structure that specifies the property key value to store in the property. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// Property keys uniquely identify a property. For example, corresponds to . This function succeeds only for properties registered + /// as part of the property schema. + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writepropertykey PSSTDAPI + // PSPropertyBag_WritePropertyKey( IPropertyBag *propBag, LPCWSTR propName, REFPROPERTYKEY value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "52965079-ECC6-411a-BBB9-4EA2B7C01631")] + public static extern HRESULT PSPropertyBag_WritePropertyKey(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [In, MarshalAs(UnmanagedType.LPStruct)] PROPERTYKEY value); + + /// + /// Stores the coordinates of a rectangle in a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: const RECTL* + /// A pointer to a RECTL structure that specifies the coordinates to store in the property. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writerectl PSSTDAPI + // PSPropertyBag_WriteRECTL( IPropertyBag *propBag, LPCWSTR propName, const RECTL *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "83C29519-CAB0-4989-85B5-70AD79E69D04")] + public static extern HRESULT PSPropertyBag_WriteRECTL(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [In, MarshalAs(UnmanagedType.LPStruct)] RECT value); + + /// + /// Sets the SHORT value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: SHORT + /// The SHORT value to which the property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writeshort PSSTDAPI + // PSPropertyBag_WriteSHORT( IPropertyBag *propBag, LPCWSTR propName, SHORT value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "9A8F0974-E7BE-4d66-8DBF-68744C0124A2")] + public static extern HRESULT PSPropertyBag_WriteSHORT(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, short value); + + /// + /// Sets the string value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: LPCWSTR + /// The string value to which the property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writestr PSSTDAPI PSPropertyBag_WriteStr( + // IPropertyBag *propBag, LPCWSTR propName, LPCWSTR value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "D3614CAE-D594-4050-B80E-20D8BBB93744")] + public static extern HRESULT PSPropertyBag_WriteStr(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.LPWStr)] string value); + + /// + /// Writes a data stream to a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: IStream* + /// A pointer to the IStream object to write to the property. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writestream PSSTDAPI + // PSPropertyBag_WriteStream( IPropertyBag *propBag, LPCWSTR propName, IStream *value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "48C3E7F7-ED7E-4797-A66A-A8529BF2A79C")] + public static extern HRESULT PSPropertyBag_WriteStream(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, IStream value); + + /// + /// Sets the ULONGLONG value of a property in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A null-terminated property name string. + /// + /// + /// Type: ULONGLONG + /// An ULONGLONG value to which the property should be set. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writeulonglong PSSTDAPI + // PSPropertyBag_WriteULONGLONG( IPropertyBag *propBag, LPCWSTR propName, ULONGLONG value ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "37854C80-00B9-465c-88D9-619695D418CD")] + public static extern HRESULT PSPropertyBag_WriteULONGLONG(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, ulong value); + + /// + /// Writes a property of an unknown data value in a property bag. + /// + /// + /// Type: IPropertyBag* + /// A pointer to an IPropertyBag object that represents the property bag in which the property is stored. + /// + /// + /// Type: LPCWSTR + /// A pointer to a null-terminated property name string. + /// + /// + /// Type: IUnknown* + /// A pointer to an IUnknown derived interface that copies the specified property of an unknown data value in a property bag. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// The property bag property function API converts between window types and the VARIANT type that is used to express values + /// in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-pspropertybag_writeunknown PSSTDAPI + // PSPropertyBag_WriteUnknown( IPropertyBag *propBag, LPCWSTR propName, IUnknown *punk ); + [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] + [PInvokeData("propsys.h", MSDNShortId = "D96643E7-9A14-4410-BD2C-A264B74E0590")] + public static extern HRESULT PSPropertyBag_WriteUnknown(IPropertyBag propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName, [MarshalAs(UnmanagedType.IUnknown)] object punk); + } +} \ No newline at end of file