|
-
Jul 2nd, 2006, 12:21 AM
#1
Thread Starter
Hyperactive Member
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:
Public Function IsRegistered(ByVal class As String) As Boolean
On Error GoTo NotRegistered
Dim obj As Object
Set obj = CreateObject(class)
IsRegistered = True
Set obj = Nothing
Exit Function
NotRegistered:
IsRegistered = False
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 
-
Jul 2nd, 2006, 02:06 AM
#2
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.
-
Jul 2nd, 2006, 08:32 AM
#3
Thread Starter
Hyperactive Member
Re: DLL Question
 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 
-
Jul 2nd, 2006, 02:33 PM
#4
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.
-
Jul 3rd, 2006, 07:28 AM
#5
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|