Can't open "DLL" File

Reply

Join Date: Oct 2007
Posts: 95
Reputation: zawpai is an unknown quantity at this point 
Solved Threads: 0
zawpai zawpai is offline Offline
Junior Poster in Training

Can't open "DLL" File

 
0
  #1
Jun 2nd, 2009
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.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Function Adding2(ByVal x As Integer, ByVal y As Integer) As Integer
  2. Adding = x + y
  3. End Function

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

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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".

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Label1.Caption = Adding2(5, 4)
  3. End Sub

if I declare as
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 802
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 146
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Can't open "DLL" File

 
0
  #2
Jun 2nd, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 95
Reputation: zawpai is an unknown quantity at this point 
Solved Threads: 0
zawpai zawpai is offline Offline
Junior Poster in Training

Re: Can't open "DLL" File

 
0
  #3
Jun 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Can't open "DLL" File

 
0
  #4
Jun 3rd, 2009
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
Last edited by QVeen72; Jun 3rd, 2009 at 2:48 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Can't open "DLL" File

 
0
  #5
Jun 3rd, 2009
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
Last edited by QVeen72; Jun 3rd, 2009 at 2:57 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 95
Reputation: zawpai is an unknown quantity at this point 
Solved Threads: 0
zawpai zawpai is offline Offline
Junior Poster in Training

Re: Can't open "DLL" File

 
0
  #6
Jun 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Can't open "DLL" File

 
0
  #7
Jun 3rd, 2009
Originally Posted by zawpai View Post
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 802
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 146
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Can't open "DLL" File

 
0
  #8
Jun 3rd, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 95
Reputation: zawpai is an unknown quantity at this point 
Solved Threads: 0
zawpai zawpai is offline Offline
Junior Poster in Training

Re: Can't open "DLL" File

 
0
  #9
Jun 4th, 2009
Hi all,

Thank you for all of your information.

Best regards,
zawpai
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC