Solved

"Can't find DLL entry point"

Posted on 1998-06-30
9
149 Views
Last Modified: 2010-05-03
I create a test dll named testDll (Axtivex DLL using VB5.0) that has a function TrippleVal:
 
    Private Function TrippleVal(ByVal theVal As Integer) As Integer
        TrippleVal = 3 * theVal
    End Function

Then I try to use the dll in a test program(also using VB5.0):

    Private Declare Function TrippleVal Lib "testDll" (ByVal v As Integer) As Integer

    Public Sub Command1_Click()
        Dim w As Integer
        w = TrippleVal(12)
    End Sub

As I run the test program, I get "can't find Dll entry point TrippleVal in testDll.dll ".
I am asking some one to help me to figure out the problem.  
0
Comment
Question by:yingchunli
  • 4
  • 3
  • 2
9 Comments
 
LVL 6

Expert Comment

by:alamo
ID: 1464643
You have TrippleVal( declared as Private, declare it as Public!
0
 

Author Comment

by:yingchunli
ID: 1464644
As I declare it as Public, I got another error "...., Declare statements not allowed as public members of object modues".  
0
 
LVL 6

Expert Comment

by:alamo
ID: 1464645
Sorry, I didn't realize I a was being ambiguous. It has to be public in the DLL. You want:

Public Function TrippleVal(ByVal theVal As Integer) As Integer
            TrippleVal = 3 * theVal
End Function

Then in the main program you can declare it

Private Declare Function TrippleVal Lib "testDll" (ByVal v As Integer) As Integer
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:yingchunli
ID: 1464646
I did it previously. I still got the same "can't find Dll entry point ...." message.
0
 
LVL 1

Accepted Solution

by:
Anita030598 earned 30 total points
ID: 1464647
Ypu don't declare thr functions for ActiveX dlls. Instead you will have to refer to ActiveX DLL by using Reference menu option. Also your function should be public and should be in Class Module.
0
 

Author Comment

by:yingchunli
ID: 1464648
Alamo:

Thank you very much for your quick answers.
I will try it next monday.  
By the way, I do not surely understand "function ....should be in Class Module" ,
and why I cannot directly use the function in DLL after the declaration as mentioned in many examples rather than "refer to ActiveX DLL by using Reference menu option"?
Have a good weekend.
0
 
LVL 6

Expert Comment

by:alamo
ID: 1464649
Well, don't thank me, thank Anita - I got so fixated on the function being "Private" I completely ignored the fact that the ActiveX DLL is a different kind of DLL. You must treat it as an object rather than declare it.

Here's the basics of how to call your ActiveX dll. (I haven't done that much of this sort of thing so it might not be perfect, but it did work for me just now):

First, go into your DLL project. Make your function Public and save it in a Class module. Name the class Class1. Build the DLL.

Now go to your test program. In the Project menu select References, then Browse to where testdll.dll is and Open it. Make sure it's checked in the "Available references" list.

Now, in your Command1_Click() sub instead of "w = TrippleVal(12) " use:
    Dim testObj As Object
    Set testObj = New TestDLL.Class1
    w = testObj.TrippleVal(12)

That should get you a lot farther... if I have anything wrong or missing hopefully Anita or someone else will say so. Sorry for the confusion.
0
 
LVL 1

Expert Comment

by:Anita030598
ID: 1464650
alamo is right. However, one small note about 'Dim testObj As Object'  When you have reference to your ActiveXDLL, it's better if you declare it by specifying the class name. For example, in this case declare it as Dim testObj As Class1. This way you get complete early binding.
0
 

Author Comment

by:yingchunli
ID: 1464651
Anita and alamo:

It works now. Thanks to both of you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 41
VBA/SQL - Connect to SQL server and pull data 4 137
TT Auto Dashboard 13 101
Help with retrieving partial value from a column using VB.NET 4 53
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question