可以 http://www.microsoft.com/china/msdn/library/dndotnet/html/callnetfrcom.asp

解决方案 »

  1.   

    楼上的兄弟!
    http://www.microsoft.com/china/msdn/library/dndotnet/html/callnetfrcom.asp
    上看了一下!好象只提到了VB6.0中的调用问题啊!!!!!
      

  2.   

    4楼的兄弟啊!C#完全手册中好象只讲到:怎样在C#中调用vc,vb写的组件啊!没有说怎么在vc中调用C#写的DLL!!!!
    你有调用的示例吗!!先谢谢了:)
      

  3.   

    可以,给个样例using System;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;
    namespace COM_Test
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    //{AD09C829-2691-4069-98AA-6640F1D7F315}
    [Guid("AD09C829-2691-4069-98AA-6640F1D7F315")]
    public interface COM_Test_Interface
    {
    [DispId(1)]
    void DoHello(string hello);
    } //{981C790B-12C7-4731-BC53-21F4D3BEE1E9}
    [Guid("981C790B-12C7-4731-BC53-21F4D3BEE1E9"),
    InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface COM_Test_Events
    {
    } //{BD0D83C4-F2EB-42b3-8793-0848E62CF449}
    [Guid("BD0D83C4-F2EB-42b3-8793-0848E62CF449"),
    ClassInterface(ClassInterfaceType.None),
    ComSourceInterfaces(typeof(COM_Test_Events))]
    public class COM_Test_Class:COM_Test_Interface
    {
    public COM_Test_Class()
    {
    //
    // TODO: 在此处添加构造函数逻辑
    //
    } #region COM_Test_Interface 成员
    public void DoHello(string hello)
    {
    // TODO:  添加 COM_Test_Class.DoHello 实现
    MessageBox.Show(hello,"C# 编写 COM 组件");
    } #endregion
    }
    }
    在VB6中这样调用,先引用,然后Private Sub Command1_Click()Dim obj As New COM_Test.COM_Test_Classobj.DoHello ("哈哈哈...C#写COM组件多容易! 哈哈哈...")End Sub
      

  4.   

    (xlfancy(xlfancy) )九楼的兄弟啊!我要的是在VC中调用啊!不是VB?还有是C#写的DLL啊!能不能具体点:)
    小弟先谢了!!!!