如何调用包含“地址"的vc ++ dll函数?作为一个论点 [英] How to call a vc++ dll function which contains "Address" as an argument

查看:134
本文介绍了如何调用包含“地址"的vc ++ dll函数?作为一个论点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以使用vb.net来帮助我调用具有内存空间地址"作为参数的VC ++ dll函数吗?


VC ++代码
---------
< code>
EXTERN_C void FAR PASCAL EXPORT CreateGUID(BSTR * bstrGUID,short ID)
{
CString strGUID;
AfxBSTR2CString(& strGUID,* bstrGUID);
ACNCreateNewGUID(strGUID,ID);
* bstrGUID = strGUID.GetBuffer();
}
</code>

dll名称为"GUIDdll".请给我分享vb.net代码片段,例如向我公开声明函数CreateGUID lib"GUIDDll.dll" ....吗?

谢谢,
Sivakumar.M.

Hi,

Can anyone help me to call a VC++ dll function which has "memory space address" as an argument using vb.net?


VC++ code
---------
<code>
EXTERN_C void FAR PASCAL EXPORT CreateGUID(BSTR* bstrGUID,short ID)
{
CString strGUID;
AfxBSTR2CString(&amp;strGUID, *bstrGUID);
ACNCreateNewGUID(strGUID,ID);
*bstrGUID = strGUID.GetBuffer() ;
}
</code>

The dll name is "GUIDdll". Please share me the vb.net code snippet like "Public declare function CreateGUID lib "GUIDDll.dll".... to me?

Thanks,
Sivakumar.M.

推荐答案

[DllImport("GUIDDll.dll")]
public static extern void CreateGUID(String bstrGUID,Uint ID);



Bstr可以用字符串替换Bstr是一个指向字符数组的指针(等效于字符串).

上面提到的是一个C#代码,也可以在Vb.net中进行一些修改使用

希望这会有所帮助:)



Bstr can be replace with string Bstr is a pointer to a array of character (which is equivalent to string).

The above mentioned is a C# code can be used with some modification in Vb.net too

Hope this helps :)


您不能只使用
Couldn''t you just use the Guid.newGuid[^] method, the .NET Framework gently hands you?
:)


这篇关于如何调用包含“地址"的vc ++ dll函数?作为一个论点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆