C#调用动态库ICDM.dll问题?

shicsheng 2009-06-22 10:18:24
动态库ICDM.dll下SetWaitTime(),StartICDMCommand(),GetSizeOfData(),GetData()和GetCmdResult()函数用C#该怎么调用,如有开发过的朋友提供一个实例参考下,高分奉送!
...全文
97 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
ghost5216 2009-06-22
  • 打赏
  • 举报
回复
这个是做什么用的 pParameters
chenchangxiong 2009-06-22
  • 打赏
  • 举报
回复
[DllImport("ICDM.dll", CharSet = CharSet.Unicode)]
void* StartICDMCommand(IntPtr device, int nAddress, int nCommand, IntPtr param, int nSizeOfParameter);
还有调用的时候要根据情况对IntPtr分配内存,用Marshal类
参数的in/out设置要适当的家ref/out
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
在线等,有帮助就加分,帮忙拉!
mawering 2009-06-22
  • 打赏
  • 举报
回复
帮顶了!
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
api提供接口函数
void* StartICDMCommand(void* pDevice, int nAddress, int nCommand, void* pParameters = NULL, int nSizeOfParameter = 0)这段代码的数据类型在C#应该是什么类型?
满衣兄 2009-06-22
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 shicsheng 的回复:]
能不能给相对路径?
[/Quote]
DllImport会按照顺序自动去寻找的地方:
1、exe所在目录
2、System32目录
3、环境变量目录
所以只需要你把引用的DLL 拷贝到这三个目录下 就可以不用写路径了
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
能不能给相对路径?
ghost5216 2009-06-22
  • 打赏
  • 举报
回复
using System.Runtime.InteropServices;
public class VideoCapture
{
[DllImport(@"C:\ICDM.dll")]
private static extern int SetWaitTime();//根据你的原型处理参数和返回
///....................
}
满衣兄 2009-06-22
  • 打赏
  • 举报
回复
没弄过.查看帮助?
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
自己先顶一下!
qiweihero 2009-06-22
  • 打赏
  • 举报
回复
http://www.phpchinaz.cn/c/CSharp/52_5201_1245637104.html和这个一模一样,晕,供你参考
qiweihero 2009-06-22
  • 打赏
  • 举报
回复
<a>参考</a>
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
void* StartICDMCommand(void* pDevice, int nAddress, int nCommand, void* pParameters = NULL, int nSizeOfParameter = 0)

这个函数的类型,C#应该怎么转?
shuohuameijiang 2009-06-22
  • 打赏
  • 举报
回复
義務頂貼
mythad 2009-06-22
  • 打赏
  • 举报
回复
把ICDM.dll拷贝到你的程序的bin目录下.

[DllImport("ICDM.dll")]
public static extern void SetWaitTime();
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
顶,各位大侠拔刀啊!
shicsheng 2009-06-22
  • 打赏
  • 举报
回复
pParameters 指向传递参数的无类型指针
超维电脑科技 2009-06-22
  • 打赏
  • 举报
回复
看到了帮你顶下.
redhat4 2009-06-22
  • 打赏
  • 举报
回复
没用过
......

110,568

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧