Can't open "DLL" File
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
zawpai
Junior Poster in Training
99 posts since Oct 2007
Reputation Points: 7
Solved Threads: 0
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
vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
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
zawpai
Junior Poster in Training
99 posts since Oct 2007
Reputation Points: 7
Solved Threads: 0
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
zawpai
Junior Poster in Training
99 posts since Oct 2007
Reputation Points: 7
Solved Threads: 0
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
vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
Hi all,
Thank you for all of your information.
Best regards,
zawpai
zawpai
Junior Poster in Training
99 posts since Oct 2007
Reputation Points: 7
Solved Threads: 0
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
vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296