如何调用包含“地址"的vc ++ dll函数?作为一个论点 [英] How to call a vc++ dll function which contains "Address" as an argument
问题描述
任何人都可以使用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(&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 :)
您不能只使用 ^ ]方法,.NET Framework
会轻轻地将您交给您吗?
:)
Couldn''t you just use the Guid.newGuid[^] method, the.NET Framework
gently hands you?
:)
这篇关于如何调用包含“地址"的vc ++ dll函数?作为一个论点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!