本文整理汇总了C#中ITypeInfo.GetVarDesc方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeInfo.GetVarDesc方法的具体用法?C# ITypeInfo.GetVarDesc怎么用?C# ITypeInfo.GetVarDesc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeInfo
的用法示例。
在下文中一共展示了ITypeInfo.GetVarDesc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVarDesc
public IntPtr GetVarDesc(ITypeInfo typeInfo, int index)
{
if (typeInfo == null) throw new ArgumentNullException(nameof(typeInfo));
IntPtr ret;
typeInfo.GetVarDesc(index, out ret);
return ret;
}
示例2: GetVarDescForVarIndex
/// <summary>
/// Helper method for retrieving type attributes for a given type info
/// This method needs to also return the native pointer to be released when we're done with our VARDESC.
/// It's not really possible to copy everything to a managed struct and then release the ptr immediately
/// here, since VARDESCs contain other native pointers we may need to access.
/// </summary>
/// <param name="typeInfo"></param>
/// <param name="varIndex"></param>
/// <param name="typeAttr"></param>
/// <param name="varDesc"></param>
/// <param name="varDescHandle"></param>
/// <returns></returns>
internal static void GetVarDescForVarIndex(ITypeInfo typeInfo, int varIndex, out VARDESC varDesc, out IntPtr varDescHandle)
{
IntPtr pVarDesc = IntPtr.Zero;
typeInfo.GetVarDesc(varIndex, out pVarDesc);
// GetVarDesc should never return null, this is just to be safe
if (pVarDesc == IntPtr.Zero)
{
throw new COMException(
ResourceUtilities.FormatResourceString("ResolveComReference.CannotRetrieveTypeInformation"));
}
varDesc = (VARDESC)Marshal.PtrToStructure(pVarDesc, typeof(VARDESC));
varDescHandle = pVarDesc;
}
示例3: GetVarDescForVarIndex
internal static void GetVarDescForVarIndex(ITypeInfo typeInfo, int varIndex, out System.Runtime.InteropServices.ComTypes.VARDESC varDesc, out IntPtr varDescHandle)
{
IntPtr zero = IntPtr.Zero;
typeInfo.GetVarDesc(varIndex, out zero);
if (zero == IntPtr.Zero)
{
throw new COMException(Microsoft.Build.Shared.ResourceUtilities.FormatResourceString("ResolveComReference.CannotRetrieveTypeInformation", new object[0]));
}
varDesc = (System.Runtime.InteropServices.ComTypes.VARDESC) Marshal.PtrToStructure(zero, typeof(System.Runtime.InteropServices.ComTypes.VARDESC));
varDescHandle = zero;
}
示例4: GetVarDesc_Proxy
private static IntPtr GetVarDesc_Proxy(ITypeInfo typeInfo, int index)
{
IntPtr varDesc;
typeInfo.GetVarDesc(index, out varDesc);
return varDesc;
}