Results 1 to 4 of 4

Thread: Declare dll error

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    9

    Question Declare dll error

    I have created a test dll and wish to use it with a program using the declare:

    "Public Declare Function OneOne Lib "COne.dll" (pOne, pTwo) As Variant"

    I get the error: "Run time error '453' Can't find DLL entry point OneOne in COne.dll"

    I have briefly read of the existance of .def files.. but I have absolutely no idea what they are and can find no information on them. Are .def files the answer to this problem? If so, how do I create such a file?

    Thank you,

    Alder

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Did you make the DLL in Visual Basic? If so then you don't declare it like that, VB makes ActiveX DLLs which are different.
    They are COM based and you would set a reference to the DLL and then dim the classes as objects.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    9

    sorry, didn't give enough info

    I want to learn to use the declare statement in case I need to create non-VB DLLs in the future. It is very frustrating that I cannot get something so small and simple looking to work. Here is all of my testing code, i made it fairly small and simple for the test:

    This is all of the code that creates the dll:
    ----------------------------------------------------------------------------
    DLL compiled name is COne.dll, vbproject name One.vbp, class name COne.cls:

    Public Function OneOne(pOne, pTwo)
    OneOne = pOne + pTwo
    End Function
    ----------------------------------------------------------------------------

    Here is all of the code of the .exe that tries to use the dll:
    ---------------------------------------------------------------------------
    Option Explicit
    Private Declare Function OneOne Lib "COne.dll" (pOne, pTwo) As Variant

    Private Sub cmdDLL_Click()
    Dim pOne, pTwo, px
    pOne = 1
    pTwo = 2
    px = OneOne(pOne, pTwo)
    MsgBox px
    End Sub
    --------------------------------------------------------------------------

    I've tried many combinations of the Declare statement. I've written out the path to the location of the dll and spent many many hours trying to get this test code to work. Is there something else I need to do?

    I got it working when I used the DLL as an object but I really wish to know how to use a dll with a declare function, I never know when I may need it.

    Thank you,

    Alder

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well, you can ONLY access the DLL you made as an object! Because it is an ActiveX DLL not a standard DLL. If you want to practice 'Declare' then practice with API calls or learn to build a DLL in C++, but there is NO way to access your DLL using the 'Declare' method. Sorry.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width