我有一个在ROT中注册的COM类,通过其他应用程序,我从ROT获取我的com类的实例并将其转换为类型,给出以下错误。
无法转换类型为' System .__ ComObject'的COM对象。接口类型' ROTViewer.IHandleVIParentInfo'。此操作失败,因为QueryInterface调用COM组件上的接口与IID' {C4B3F18E-FDF1-3F0C-A6DB-F03B302CAE9F}'由于以下错误而失败:不支持此类接口(来自HRESULT的异常:0x80004002(E_NOINTERFACE))。
以下是我的COM类实现
overflow:hidden
以下是我将类型转换为我的com类类型
的方法public interface IHandleVIParentInfo
{
Dictionary<int, string> ContainerParentredVi {get; set;}
int GetListCount();
}
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IHandleVIParentInfo))]
[ProgIdAttribute("Qcs.VIParentedInfoHandler")]
[GuidAttribute(HandleVIParentedInfo.Guid)]
[DisplayName("Qcs VI Parented Info Handler")]
public class HandleVIParentedInfo : IDisposable, IHandleVIParentInfo
{
public const string Guid = "CB6BFC97-F8E3-4fce-B68B-4D01485811A1";
public Dictionary<int, string> ContainerParentredVi
{
get
{
return _containerParentredVi;
}
set
{
_containerParentredVi = value;
}
}
private Dictionary<int, string> _containerParentredVi = new Dictionary<int, string>();
public HandleVIParentedInfo()
{
//private Dictionary<int, string> _containerParentredVi = new Dictionary<int, string>();
}
#region IDisposable Members
void IDisposable.Dispose()
{
throw new NotImplementedException();
}
#endregion
#region IHandleVIParentInfo Members
int IHandleVIParentInfo.GetListCount()
{
return ContainerParentredVi.Count;
}
#endregion
在行中收到错误&#34; viParenting =(IHandleVIParentInfo)rotEnumerator.Value;&#34;