[英]exposing .Net to COM
我要在VB6中使用一些.Net功能。 我遵循了一些教程。 我使用以下公式成功编写了一个测试程序: http : //www.codeproject.com/Articles/3511/Exposed-NET-Components-to-COM
但是,当我尝试使用实际项目执行此操作时,ProgId不会像测试文件一样显示在注册表中。 我确保属性ComVisible == true
using System.Runtime.InteropServices;
namespace Controls.Graph.Web
{
[Guid("5F9F6C6F-016A-4CFF-BD7A-3463761807E1")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _GraphScript
{
[DispId(1)]
string getGraphXml();
}
[Guid("35901BC6-EFF1-490C-84FA-786E8462C553")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId(ProgIds.GraphScript)]
public class GraphScript : _GraphScript
{
protected GraphScript()
{
}
/// <summary>
///
/// </summary>
/// <returns>The graphs xml and javascript</returns>
public string getGraphXml()
{
DisplayDefaults tempDefaults;
tempDefaults = new DisplayDefaults();
GraphConstructor graph = new GraphConstructor();
graph.constructGraph();
GraphModel completedGraph = graph.Graph;
return GraphControl.RenderGraph(completedGraph, tempDefaults, 1) + GraphControl.RenderGraphScript();
}
}
}
还有我的长官
using System;
namespace Controls.Graph.Web
{
/// <summary>
/// ProgID Constant
/// </summary>
public static class ProgIds
{
public const string GraphScript = "GraphData";
}
}
我不确定在这里我错过了哪个难题
编辑:实际上Guid显示在注册表中,但是Progid仍然没有。 有什么想法/建议吗?
还请确保执行以下操作:
我已经弄清楚出了什么问题。 我需要将一些访问修饰符更改为GraphScript()
包括我的GraphScript()
构造函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.