Hi,

Could you please show me where my error is?
I have created one "DLL" file by myself. Then, I want to reuse it in another project, but the system prompt error message whenever I call that "DLL" function.

I created "DLL" with "ActiveXDll". The following is my dll code.

Public Function Adding2(ByVal x As Integer, ByVal y As Integer) As Integer
    Adding = x + y
End Function

After compiling, I get "project.dll". Finally, I declare this dll's function as below.

Public Declare Function Adding2 Lib "project1.dll" (ByVal x As Integer, ByVal y As Integer) As Integer

Error, run time error "53", is "File not found".

Private Sub Command1_Click()
    Label1.Caption = Adding2(5, 4)
End Sub

if I declare as

Public Declare Function Adding2 Lib "C:\Documents and Settings\Zawpai\Desktop\test extsiting file 3\project1.dll" (ByVal x As Integer, ByVal y As Integer) As Integer

, it shows "run time error 453". can't find dll entry point.

How should I solve above problem? Please give me some suggestion.

regards,
zawpai

Okay, did you move your project.dll into the same folder as your new project that wants to call it or did you move the project dll to the \windows\system32\ directory? Did you register the dll?

Good Luck

Hi vb5prgrmr,

Yes, I copy dll file in the same folder.

did you move the project dll to the \windows\system32\ directory?
yes, I put the dll in system32.

Did you register the dll?
Yes, I did.

Would you like to run my sample program?

Anyone can me?

regards,
zawpai

Hi,

First Open a New Project, Goto References, Browse and add the Dll, from the list (Project1.dll)
And Declare like this :

Dim TempCls As New Project1.MyClass
Text1.Text = TempCls.Adding2(4, 10)

The procedure you have declared is for WIN API's..


Regards
Veena

Hi,

Also, I noticed, there is a problem in your function:

Public Function Adding2(ByVal x As Integer, ByVal y As Integer) As Integer
'Adding = x + y
' Above line has to be name of function
Adding2 = x + y
End Function

Regards
Veena

Hi QVeen72,

Thank you for your help. Now, my coding is running well.

May I ask you another question?
Why some dll files don't need to do "browse" and "add"?

I saw they only need to declare function prototype and the function of dll flie can be used directly. Their coding also doesn't need to create as object type. They only put their dll file in the same folder.

Where is the difference with our method?

For my understanding is that I create dll as class type. So, we have to declare as object type before we use its function. Then, we also don't need to declare function prototype.

regards,
zawpai

Hi QVeen72,
Why some dll files don't need to do "browse" and "add"?
zawpai

If the DLL File is Already Registered using Regsvr or any other method, , it automatically appers on the List.

But when you have created a new dll, it may not have been registered, so it does not apper on the list. If you browse and Add, VB6 Automatically Registers the dll for you..
Once you do that, you can notice, if you open a new project, this New dll will appear on the list..


Regards
Veena

The reason for the difference between the need for an API call and browse and add is the difference between a standard dll and an activex dll.

Good Luck

Hi all,

Thank you for all of your information.

Best regards,
zawpai

i created One ActiveX DLL and i want to reuse in other vb program.
I declare the procedure which i want to use in my vb program, "Private Declare Sub CreateFile Lib "FileUtil.dll" _
(ByVal FilePath As String, ByVal FreeFile As Integer, ByVal UniCodeTF As String)".I already registered this DLL. I copied the dll in vb program folder , copied to \windows\system32\ and already registered. But still not working, give me the error as "Can't find DLL entry point....."
Please help me!

Thanks!

Ahhhh!!!! another necrophiliac!!! He plays with the dead!!!! I mean just gross!!!! Nasty!!! Yuck!!! :)

All kidding aside yimon, raising the dead threads is not nice as it gives the people the willies!!!

In the future, when you have a question to ask and there is a thread that is similar, please copy its url into your new thread if you need to reference it.

As for your question, the API declaration is for standard dll's and as such yours is an activex dll what you need to do is... Project>references>browse>select dll>ok. Then you should be albe to reference like any other reference in VB.

If that did not help, then it is time to use your friends (yahoo, google, ask, answers, bing) to search for vb activex dll tutorial...

Good Luck

This article has been dead for over six months. Start a new discussion instead.