2006-11-07

关于C#中的DLLImport

来源: 本站收集整理 作者:佚名 评论 0 条
 

}

publicstring IniReadValue(string Section,string Key)

{

StringBuilder temp = new StringBuilder(255);

int i = GetPrivateProfileString(Section,Key,"",temp,255,this.path);

return temp.ToString();

}

}

网上关于DllImport的很多问题是由于所调方法的参数比较复杂,现在我还没用到,看到一篇贴子,参数中带指针的,也先录下来,以备将来查用:

参数是用指针来获取一个数组:Int GetData(byte * pBuffer)

pBuffer是数组的首地址,也就是说GetData会写pBuffer[0],pBuffer[1]....pBuffer[100];

答曰:

[DllImport("yourDllFile.dll"]

Private static extern int GetValue([MarshalAs(UnmanagedType.LPArray)]byte[] pValue);

假如是out参数,可以如下

[DllImport("yourDllFile.dll")]

Private static extern int GetValue([Out,MarshalAs(UnmanagedType.LPArray)]byte[] pValue);


共2页: 上一页 [1] 2 下一页
(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:Java多线程编程基础之线程和多线程  
下一篇:JAVA字符集
    评论加载中…
 推荐文章
     

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号