Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

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


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 :)
 
Share this answer
 
v2
Couldn't you just use the Guid.newGuid[^] method, the .NET Framework gently hands you?
:)
 
Share this answer
 
Comments
sivakumar.mariappan 15-Sep-10 9:46am    
Sorry...our clients are using the above vc++ dll to create the GUID in some different way. Our tool will only accept the GUID, creates by this vc++ dll only. That's why i am asking how to pass the values to this fucntion.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900