public class sg
{
[DLLImport("User32.dll")]
public static extern int MessageBox(int hwnd,string Message,string Caption,int type)}
class app
{
static void Main(string[] args)
{
dg.MessageBox("nihao");
}
}
这个是在windows中的 asp.net一样的原理
{
[DLLImport("User32.dll")]
public static extern int MessageBox(int hwnd,string Message,string Caption,int type)}
class app
{
static void Main(string[] args)
{
dg.MessageBox("nihao");
}
}
这个是在windows中的 asp.net一样的原理
1.键入 tlbimp tcon.dll (这步注册一个代理)
2.然后键入 regsvr32 tcon.dll (在注册表注册该组件)
注意:上面两步都是在tcon.dll的目录下
class app
{
static void Main(string[] args)
{
tcon.Method();//调用tcon的Method方法
}
}
然后再vs.net中引用COM组件。比如组件叫 COMCLIENT
之后在程序中
using System.Runtime.InteropServices;
using COMCLIENT;
http://www.codeproject.com/csharp/unmanage.asp