From: Dave Wurtz on
In my VB.NET application, I'm trying to call a function from a 32-bit,
non-.NET dll file and I'm having problems. I believe I have the
correct signature for the dll with:

<System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")>
_
Public Shared Function BuildCompositeFile(ByVal szOldFile As
System.IntPtr, _
ByVal szNewFile As System.IntPtr, _
ByVal szCompositeFile As System.IntPtr, _
ByVal szOldPrefix As System.IntPtr, _
ByVal szNewPrefix As System.IntPtr, _
ByVal szCompositePrefix As System.IntPtr, _
ByVal bCheckForChangedImages As System.Boolean) As System.Int32
End Function


I'm trying to call this function with the following code:

Dim html1 As System.String = "c:\test1.htm"
Dim html2 As System.String = "c:\test2.htm"
Dim composite As System.String = "c:\changes.htm"

Dim changes As System.Int32 = GlobalApp.BuildCompositeFile( _
System.Runtime.InteropServices.Marshal.ReadIntPtr(html1, 0), _
System.Runtime.InteropServices.Marshal.ReadIntPtr(html2, 0), _
System.Runtime.InteropServices.Marshal.ReadIntPtr(composite, 0), _
System.Runtime.InteropServices.Marshal.ReadIntPtr(".htm", 0), _
System.Runtime.InteropServices.Marshal.ReadIntPtr(".htm", 0), _
System.Runtime.InteropServices.Marshal.ReadIntPtr(".htm", 0), _
True)

When I run this, I get the error:
An exception of type 'System.EntryPointNotFoundException' occurred in
ProductVision.Windows.Forms.dll but was not handled in user code.
Additional information: Unable to find an entry point named
'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.

What am I doing wrong?

Thanks in advance!
Dave
From: Herfried K. Wagner [MVP] on
Am 08.06.2010 00:05, schrieb Dave Wurtz:
> In my VB.NET application, I'm trying to call a function from a 32-bit,
> non-.NET dll file and I'm having problems. I believe I have the
> correct signature for the dll with:
>
> <System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")>
>[...]
> When I run this, I get the error:
> An exception of type 'System.EntryPointNotFoundException' occurred in
> ProductVision.Windows.Forms.dll but was not handled in user code.
> Additional information: Unable to find an entry point named
> 'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.

Maybe the function has a different name. You may want to use Dependency
Walker (<URL:http://www.dependencywalker.com/>) to examine the function
the DLL exports.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
From: Dave Wurtz on
On Jun 7, 5:16 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...(a)gmx.at> wrote:
> Am 08.06.2010 00:05, schrieb Dave Wurtz:
>
> > In my VB.NET application, I'm trying to call a function from a 32-bit,
> > non-.NET dll file and I'm having problems.  I believe I have the
> > correct signature for the dll with:
>
> > <System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")>
>  >[...]
> > When I run this, I get the error:
> > An exception of type 'System.EntryPointNotFoundException' occurred in
> > ProductVision.Windows.Forms.dll but was not handled in user code.
> > Additional information: Unable to find an entry point named
> > 'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.
>
> Maybe the function has a different name.  You may want to use Dependency
> Walker (<URL:http://www.dependencywalker.com/>) to examine the function
> the DLL exports.
>
> --
>   M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>   V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

Thanks for the reply.

As suggested, I downloaded the Dependency Walker program and opened
the DLL. In looking at the function I want to call and selecting
"Undecorate C++ Functions", this is what it shows:

int BuildCompositeFile(char *,char *,char *,char *,char *,char *,int)

Do I have the correct signature defined?

Thanks.
Dave
From: Dave Wurtz on
On Jun 8, 7:56 am, Dave Wurtz <dave_wu...(a)asdsoftware.com> wrote:
> On Jun 7, 5:16 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
>
>
>
>
>
> h...(a)gmx.at> wrote:
> > Am 08.06.2010 00:05, schriebDaveWurtz:
>
> > > In my VB.NET application, I'm trying to call a function from a 32-bit,
> > > non-.NET dll file and I'm having problems.  I believe I have the
> > > correct signature for the dll with:
>
> > > <System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")>
> >  >[...]
> > > When I run this, I get the error:
> > > An exception of type 'System.EntryPointNotFoundException' occurred in
> > > ProductVision.Windows.Forms.dll but was not handled in user code.
> > > Additional information: Unable to find an entry point named
> > > 'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.
>
> > Maybe the function has a different name.  You may want to use Dependency
> > Walker (<URL:http://www.dependencywalker.com/>) to examine the function
> > the DLL exports.
>
> > --
> >   M S   Herfried K. Wagner
> > M V P  <URL:http://dotnet.mvps.org/>
> >   V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
>
> Thanks for the reply.
>
> As suggested, I downloaded the Dependency Walker program and opened
> the DLL.  In looking at the function I want to call and selecting
> "Undecorate C++ Functions", this is what it shows:
>
> int BuildCompositeFile(char *,char *,char *,char *,char *,char *,int)
>
> Do I have the correct signature defined?
>
> Thanks.Dave- Hide quoted text -
>
> - Show quoted text -

Can anyone tell me if I have the correct signature defined here? Once
again, Dependency Walker showed the following for the function inside
the DLL that I am trying to call:

int BuildCompositeFile(char *,char *,char *,char *,char *,char *,int)

I have tried to create the equivalent signature in my VB.Net
application:


<System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")>
_
Public Shared Function BuildCompositeFile(ByVal szOldFile As
String, _

ByVal szNewFile As String, _

ByVal szCompositeFile As String, _

ByVal szOldPrefix As String, _

ByVal szNewPrefix As String, _

ByVal szCompositePrefix As String, _

ByVal bCheckForChangedImages As Integer) As Integer
End Function

I must be doing something wrong because when I call the function, I
get the error:

An exception of type 'System.EntryPointNotFoundException' occurred in
ProductVision.Windows.Forms.dll but was not handled in user code.
Additional information: Unable to find an entry point named
'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.

Can someone help me with this please.

Thanks in advance!
Dave
From: Armin Zingler on
Am 17.06.2010 22:57, schrieb Dave Wurtz:
> <System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")>
> _
> Public Shared Function BuildCompositeFile(ByVal szOldFile As
> String, _
>
> ByVal szNewFile As String, _
>
> ByVal szCompositeFile As String, _
>
> ByVal szOldPrefix As String, _
>
> ByVal szNewPrefix As String, _
>
> ByVal szCompositePrefix As String, _
>
> ByVal bCheckForChangedImages As Integer) As Integer
> End Function
>
> I must be doing something wrong because when I call the function, I
> get the error:
>
> An exception of type 'System.EntryPointNotFoundException' occurred in
> ProductVision.Windows.Forms.dll but was not handled in user code.
> Additional information: Unable to find an entry point named
> 'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.

Try it with
Declare Function...
with same name and same types.

Also try
Declare Ansi Function...

--
Armin