using static Vanara.PInvoke.OleAut32;
namespace Vanara.PInvoke;
public static partial class Shell32
{
/// Initializes a VARIANT structure with a string stored in a STRRET structure.
///
/// Type: STRRET*
/// Pointer to a STRRET structure.
///
///
/// Type: PCUITEMID_CHILD
/// PIDL of the item whose details are being retrieved.
///
///
/// Type: VARIANT*
/// When this function returns, contains the initialized VARIANT structure.
///
///
/// Type: HRESULT
/// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Creates a VT_BSTR variant.
/// Note This function frees the resources used for the STRRET contents.
/// Examples
/// The following example, to be included as part of a larger program, demonstrates how to use InitVariantFromStrRet.
///
// https://docs.microsoft.com/en-us/windows/win32/api/propvarutil/nf-propvarutil-initvariantfromstrret PSSTDAPI
// InitVariantFromStrRet( STRRET *pstrret, PCUITEMID_CHILD pidl, VARIANT *pvar );
[DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)]
[PInvokeData("propvarutil.h", MSDNShortId = "8e9542a9-9ed0-4e44-b9b1-32b31151bd8e")]
public static extern HRESULT InitVariantFromStrRet(in STRRET pstrret, PIDL pidl, out VARIANT pvar);
/// If the source variant is a VT_BSTR, extracts string and places it into a STRRET structure.
///
/// Type: REFVARIANT
/// Reference to a source variant structure.
///
///
/// Type: STRRET*
/// Pointer to the extracted string if one exists.
///
///
/// Type: HRESULT
/// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/win32/api/propvarutil/nf-propvarutil-varianttostrret PSSTDAPI VariantToStrRet( REFVARIANT
// varIn, STRRET *pstrret );
[DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)]
[PInvokeData("propvarutil.h", MSDNShortId = "dfc1f52e-58c6-48fd-8da9-1d4d5115912c")]
public static extern HRESULT VariantToStrRet(in VARIANT varIn, out STRRET pstrret);
}