一个关于DLL的问题!救急啊!!!!! 可以 http://www.microsoft.com/china/msdn/library/dndotnet/html/callnetfrcom.asp 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上的兄弟!http://www.microsoft.com/china/msdn/library/dndotnet/html/callnetfrcom.asp上看了一下!好象只提到了VB6.0中的调用问题啊!!!!! 4楼的兄弟啊!C#完全手册中好象只讲到:怎样在C#中调用vc,vb写的组件啊!没有说怎么在vc中调用C#写的DLL!!!!你有调用的示例吗!!先谢谢了:) 可以,给个样例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 (xlfancy(xlfancy) )九楼的兄弟啊!我要的是在VC中调用啊!不是VB?还有是C#写的DLL啊!能不能具体点:)小弟先谢了!!!! checkListBox怎么取消选中 高分悬赏!!!关于调用kernel32.dll出现的问题 郁闷问题,请帮忙 如何让生成缩略图品质高、文件小?(原图片品质高的前提下) 菜鸟搞了一个hello程序,怎么打包成setup.exe? List的Select问题 email格式验证 关于BYTE[]字节数组处理的问题 请教正则问题 通过编程能不能获取存储过程的内容? 请教:怎样用C#实现网页上的倒计时时钟? 我实在是没招了,向高手请教关于base64解码的问题!!
http://www.microsoft.com/china/msdn/library/dndotnet/html/callnetfrcom.asp
上看了一下!好象只提到了VB6.0中的调用问题啊!!!!!
你有调用的示例吗!!先谢谢了:)
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
小弟先谢了!!!!