如题。请简单给个例子。
解决方案 »
- 求助C#多数据库操作
- 各位大侠 提供点 C#创建 周期性事务管理的 方法 饿、、、最好有源代码
- =?gbk?B?wLbM7LDX1MYuanBn?=解码
- 如何提取软件界面中的图片?【有难度】
- WindowsMoblie安装程序制作问题
- SqlDtatSource 多视图
- 关于timer的小问题
- 新手请教:c#中的数组在实例中有什么运用?
- xml文件的读取 并在Treeview控件上显示
- 如何实现单击datagrid行产生菜单?
- 通过SMTP的方式用yahoo.cn的邮箱发送邮件的问题,很怪,高分(100),
- ERROR [07002] [Microsoft][ODBC Excel Driver] 参数不足,期待是 3
看了这个例子,你应该会了,这样声明一下就可以用了
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern IntPtr GetWindowDC(IntPtr hwnd);
#include "StdAfx.h"
#include "Dll.h"
extern "C" __declspec(dllexport) int fun(int x1,int x2,int x3)
{
return x1+x2+x3;
}
编译成 CDLL6.dll
C#public class Win32API
{
/// <summary>
///
/// </summary>
/// <param name="ncb"></param>
/// <returns></returns>
[DllImport("CDLL6.dll")]
public static extern int fun(int x1, int x2, int x3);
}
调用:int j = Win32API.fun(1,2,3);
[DllImport("CDLL6.dll")]引用的时候为什么有错误?