Jump to content
Xtreme .Net Talk

cackle

Members
  • Posts

    3
  • Joined

  • Last visited

cackle's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. How do I make a reference to a COM Object in a WebService that I am making in Web Matrix? Thanks.
  2. The int thing is right. Here's how I fixed the strings (with help from my co-worker): Public Declare Function GetResultsTextBSTR Lib "BridgerTracker.dll" (ByVal iFormat As enumBridgerTrackerFormat) As <MarshalAs(UnmanagedType.BSTR)> String The string was being returned as a Binary string by the DLL and I hadn't told VB.NET that was the case.
  3. Hello everyone. Thanks in advance for your advice. I'm building a web service that needs to access a DLL that was written in C++. I saw somewhere that the way to access a specific function from a DLL is to declare it thusly: Public Declare Function GetResultsTextBSTR Lib "BridgerTracker.dll" (ByVal iFormat As enumBridgerTrackerFormat) As String This seems to work in terms of allowing the program to recognize the function. However, when I call this function (or any other function from the DLL that returns a string), I'm only getting the first character of what should be returned. For example, if the function is supposed to return "Numer of Matches: 90" it returns "N" instead. I have a feeling this has to do with two thngs -- that the DLL was written with VB 6.0 in mind and also it was written in C++, so I have to do some sort of conversion. Functions that return an integer are also not returning the right number by a factor of 4 billion. The example code that was given to me actually does do a conversion, but it is a conversion that was deprecated from VB 6.0 to VB.NET. I found the way to do it in VB.NET and it still doesn't work. Just for reference, here's what I changed for that conversion: StrConv(GetLastErrorMessageBSTR(), vbFromUnicode) goes to: Dim s As String Dim b() As Byte b = System.Text.UnicodeEncoding.Unicode.GetBytes(GetLastErrorMessageBSTR()) s = System.Text.ASCIIEncoding.ASCII.GetString(b) Does anyone have an idea of what I can do? I'm using ASP.NET Web Matrix to program this Web Service. Thanks.
×
×
  • Create New...