Calling functions from my ActiveX DLL?
Results 1 to 8 of 8

Thread: Calling functions from my ActiveX DLL?

  1. #1
    Registered User
    Join Date
    Oct 2000
    Location
    Kansas City, MO
    Posts
    1,162

    Post Calling functions from my ActiveX DLL?

    all my code the activex.dll is working...

    so i create a simple exe project and declare my dll...

    then when my app calls the function from my dll i get this error...

    runtime error "453"
    can't find entry point myfucntionname in myactivex.dll

    any solutions?

    os: windows2k
    VB Pro 6 no service packs

  2. #2
    Registered User
    Join Date
    Jan 1999
    Location
    London, Great Britain
    Posts
    300

    Lightbulb

    Have you declared your function within your DLL as a PUBLIC function? If you haven't, you won't be able to see that function outside the DLL.

    Use the Object Explorer (hit F2 in VB) and select your DLL from the list to view the exposed functions in your DLL.

    If this isn't the problem, check your compile options and recompile the DLL to ensure that it was compiled properly - you may have broken the project compatibility somehow and it needs to be recompiled.

    HTH,
    (and yes, I'm back from a 2 week break!)

  3. #3
    Registered User
    Join Date
    Oct 2000
    Location
    Kansas City, MO
    Posts
    1,162

    Post

    Originally posted by antonye:
    <STRONG>
    HTH,
    (and yes, I'm back from a 2 week break!)</STRONG>
    nice to see u around again. shoot, i thought u left us.

    as far as the dll functions being public, yes they are.

    what is the purpose of a activex dll? what are pros and cons? i'm wanting to build this dll with all my most common functions and routines so when i create a new app i just declare the my dll for the proper function i want...

    would this be a good time to learn C/C++?

    thx pal

  4. #4
    Registered User
    Join Date
    Jan 1999
    Location
    London, Great Britain
    Posts
    300

    Lightbulb

    It looks like you've probably declared the DLL incorrectly to the program.

    You should add a reference to your DLL (through the Project -> References menu) and then declare the full class name like this:

    Code:
    Dim oMyFunc as MyDll.MyClass
    ...
    Set oMyFunc = new MyDll.MyClass
    That should fix your reference problems.
    HTH.

  5. #5
    Registered User
    Join Date
    Jan 1999
    Location
    London, Great Britain
    Posts
    300

    Post

    To answer the second part:

    Originally posted by opiate:
    what is the purpose of a activex dll? what are pros and cons? i'm wanting to build this dll with all my most common functions and routines so when i create a new app i just declare the my dll for the proper function i want...
    would this be a good time to learn C/C++?
    This is the exact way you should be using a DLL - you can take all your most common functions/routines and put them all into a DLL.

    Each time you create a new program, you simply reference the same routines in your DLL so it saves you writing the same code again.

    I have a similar set, with routines that I use for stuff like encryption/decryption.

    You want to do this because it saves you writing the same code over and over again so it gets your programs finished quicker. It also means that you don't forget how to do a particular function once you have a working routine - I've done this a few times and lost hours trying to remember how I solved a particular problem I knew I'd done before!

    The disadvantages are that you need to ensure that your DLLs stay backwards compatible with each other, else you may be in the position where you break one program by "fixing" a problem with another.

    You also have distribution problems because you need to track who has the DLL (it may also be used in some program on a remote server that only gets used once every 3 years or something) and you may find you're distributing to people whose program doesn't use the function you're updating.

    I always think the trick is to not include too simple routines in a DLL (like one that double-quotes an SQL string for example), but try to write a set of function for a particular subject, like an FTP dll or an Encryption/Decryption dll and try not to mix them. That way you will have a whole library of DLLs that you simply reference for a project.

    As for C++, well we've covered this subject before! In my (honest) opinion, the extra effort involved in learning and creating DLLs using C/C++ is not worth the very small performance gains you're going to get over a VB equivalent DLL. The code optimiser is so much better than it was with earlier version of VB and processors are now so much faster (and cheaper) that it's really not worth the extra effort.

    HTH,
    I'd rather die peacefully in my sleep like my Grandfather,
    than screaming in terror like his passengers.
    Jim Harkins
    <a href="http://www.Horrible.Demon.co.uk/" target="_blank">http://www.Horrible.Demon.co.uk/</a>

  6. #6
    Registered User
    Join Date
    Oct 2000
    Location
    Kansas City, MO
    Posts
    1,162

    Post

    cool, thanks

  7. #7
    Archangel_of_Underworld
    Guest

    Post

    I used to know VB pretty well, that was two years ago. Know I am reteaching myself. I have not read anything about dll's so far. Any good books you could recommend? I am also finding it hard to practice writing app's because, I simply don't have any app's to write. Is there any websites or books that provide exercises that you know of?

  8. #8
    Registered User
    Join Date
    Oct 2000
    Location
    Kansas City, MO
    Posts
    1,162

    Post

    Originally posted by Archangel_of_Underworld:
    <STRONG>I used to know VB pretty well, that was two years ago. Know I am reteaching myself. I have not read anything about dll's so far. Any good books you could recommend? I am also finding it hard to practice writing app's because, I simply don't have any app's to write. Is there any websites or books that provide exercises that you know of?</STRONG>

    All you really need to know how to do is write functions and subs. Then once your dll is referance you just call one of your functions from the class.

Bookmarks

Posting Permissions

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