Solved

"Can't find DLL entry point"

Posted on 1998-06-30
9
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Technology Partners: 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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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