I'm trying to use VB.net with projectwise ,I tried to add some dll's from projectwise explorer to my project but it cause an error of "a refrence to this file couldn't be added please make sure this file is accessible and that is a valid assembly or com component", So I tried to use <DllImport ("dmsgen.dll")> _ then write functions but the datatypes cause errors example(LPCWSTR and LPCWSTR) Any help about that??
Walla, I am not a VB.NET progammer but I did find something that may help. Take a look at this post and reply
LPCWSTR and LPCTSTR are should translate into the VB type String. They are the way to say that you are sending a string by value in Microsoft C++.
Again if you are using VB.NET and use the <DLLImport> it will Marshall the values passed between Managed and Unmanaged code automatically.
When you do a declaration you have to make sure you are using Unicode though.
So a declaration will look like this: (C#)
[DllImport("dmscli.dll", CharSet = CharSet.Unicode, EntryPoint= "aaApi_EncryptLoginPassword")]
public static extern string EncryptLoginPassword(string userPassword);
<DllImport("dmscli.dll", CharSet:=CharSet.Unicode, EntryPoint:="aaApi_EncryptLoginPassword")> _
Public Shared Function EncryptLoginPassword(ByVal userPassword As String) As <MarshalAs(UnmanagedType.LPWStr)> String
'This is an empty function template, do not add code here, the call will be directed to the external dll.
Declare Auto Function EncryptPassword Lib "dmscli.dll" Alias "aaApi_EncryptLoginPassword" (<MarshalAs(UnmanagedType.LPWStr)> ByVal password As String) As <MarshalAs(UnmanagedType.LPWStr)> String
Please note that the <MarshallAs> attributes are not really required for the Declare Auto Function so it can just be declared as:
Declare Auto Function EncryptPassword Lib "dmscli.dll" Alias "aaApi_EncryptLoginPassword" (ByVal password As String) As String, and it should work fine.