Using VB4 APIs in VB.NET ?

G

Guest

Hi,

I have an API (DLL) file that was developed in VB4 or VB5, and I have its
old poor documentation (before the .NET era). I'm unable to import and use
this old DLL file in the VB.NET!

I tried to "Add Reference" in the VS.NET IDE but it said the DLL is not a
valid assembly or COM component.

An example from the document is:
'------------------------------------------------------------
Private Declare Function attach Lib ".\vc_dll.dll" (ByVal gdt_host_id As
Byte, ByVal pwd_string As String) As Long
'------------------------------------------------------------

I tried the following code in VB.NET:
'------------------------------------------------------------
Declare Auto Function attach Lib "C:\vc_dll.dll" (ByVal host_id As Byte,
ByVal pwd_string As String) As Integer

Sub test()
MsgBox(attach(1,0))
End Sub
'------------------------------------------------------------

And I got an error saying: "Unable to find an entry point named attach in
DLL C:\vc_dll.dll"

Can someone tell me how I can use this DLL in my VB.NET program?
 
H

Herfried K. Wagner [MVP]

Amjad said:
I have an API (DLL) file that was developed in VB4 or VB5, and I have its
old poor documentation (before the .NET era). I'm unable to import and use
this old DLL file in the VB.NET!

Well, it is important to know if the DLL is a 32-bit DLL or a 16-bit-DLL.
If the DLL was created using VB4-32 or VB5 it should be possible add a
reference to the DLL.

It's very unlikely that 'DllImport' or 'Declare' work because VB DLLs
typically do not export a function-based API.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top