Results 1 to 5 of 5

Thread: DLL Question

  1. #1

    Thread Starter
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    DLL Question

    Hello everyone, got another question concerning DLLs.

    First, I found a code to check if an activeX object is registered or not, Im not sure if its the best method to check or not. But this is the code:

    VB Code:
    1. Public Function IsRegistered(ByVal class As String) As Boolean
    2. On Error GoTo NotRegistered
    3. Dim obj     As Object
    4.  
    5.     Set obj = CreateObject(class)
    6.     IsRegistered = True
    7.     Set obj = Nothing
    8.     Exit Function
    9.  
    10. NotRegistered:
    11.     IsRegistered = False
    12. End Function

    This works fine. But I wanted to know with a function like CreateObject, are you able to find out where the object your trying to load is located on the computer?

    Meaning I have my dll at C:\Folder1\test\MyLibrary.dll

    I use that to check it by doing:

    IsRegistered(MyLibrary.Check)

    Check being a class file within the DLL. That would return true if it has been registered before.

    Im wonder if, with CreateObject, you can find the path of where the file is located, as well as get the version of the file.

    Thanks

    - Wiccaan
    Last edited by wiccaan; Jul 2nd, 2006 at 08:32 AM.
    If my post was helpful please rate it

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: DLL Question

    One problem with your code is that after you create the object you never destroy it. Create Object will not tell you where the file is located. You need to check the registry.

  3. #3

    Thread Starter
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Re: DLL Question

    Quote Originally Posted by randem
    One problem with your code is that after you create the object you never destroy it. Create Object will not tell you where the file is located. You need to check the registry.
    Ah I missed the Set obj = Nothing, sorry about that.

    Do you have any examples of how to read the registry for a certain DLL? Also, Ive noticed that in the registry, it saves all the ActiveX components as Version 1.0. Which is.. well.. incorrect. Any idea's about that too?

    I was going to use the TLBINF32.DLL functions to do this but it also has the problem of showing the version as 1.0 only. Even if the version is set to like 1.5.0.68 or something.

    Thanks for the reply.

    - Wiccaan
    If my post was helpful please rate it

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: DLL Question

    You can look in my signature for Free VB Source Code and find the project Enumerate thru the Registry. You can use that for a start.

  5. #5

    Thread Starter
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Re: DLL Question

    I decided to just have it write the value itself and then just check it each time the program is loaded. I added some error checking and such as well so its working flawlessly

    Thanks for the help though.
    If my post was helpful please rate it

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