OK, I have been fighting this for three days under the
assumption that the
dll was written in Delphi. I finally spoke with the author
this morning (he
was on vacation last week), and he said the dll was written
in Borland C++.
He sent me the C++ declarations, and I see that he is using
return values
and parameters of the type ShortString and AnsiString.
These are based on
templates in the Borland C++, and I don't have the
definitions of these
templates.
Can anyone tell me what types these equate to in VB.Net?
String doesn't
work for the ShortString type. I am not sure about the
AnsiString type
because all of the functions that use AnsiString also use
ShortString.
FYI, I used the DllInvoke method of defining the dll
functions in VB.Net,
and the error message changed to a protection error - trying
to read or
write protected memory.
Thanks,
Kelly Baker
-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNET DISCUSS.DEVELOP.COM] On Behalf Of Mike
Andrews
Sent: Thursday, August 10, 2006 1:18 PM
To: VBDOTNET DISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Trouble accessing a dll written in
Delphi
Kelly,
Try using either the Unicode part of the declare.
If the version of Delphi it was compiled under is fairly
new, it may require
Unicode strings.
I ran into a similar situation with one of the Win32 dlls.
I couldn't get
it to work until I specified Unicode.
Your syntax looks correct, though.
Thanks,
Mike
On 8/10/06, Kelly Baker <kbaker howard-ind.com> wrote:
>
> I have a VB.Net 2005 project that I need to access a
third party dll that
> was written in Delphi. I have tried registering the
dll and tried the
> Declare statement. Is there any other way to access a
dll? Has anyone
> worked with dlls written in Delphi before? If it would
help, I could send
> the dll (very small) and a function or two that are in
the dll for
> somebody
> to experiment with.
>
> The dll won't register as ActiveX, and one of my
declare statements is:
>
> Public Declare Ansi Function CheckVersionConfigFile Lib
> "C:\MyRefs\HowardIndustries.dll" (ByVal
ConfigDirectory As String) As
> String
>
> The declaration in Delphi (given as documentation of
the function) is:
>
> function
CheckVersionConfigFile(ConfigDirectory:AnsiString):ShortStri
ng
>
> Any ideas?
>
> Kelly
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|