Link to home
Start Free TrialLog in
Avatar of CodedK
CodedKFlag for Greece

asked on

How to find out if a dll is registered or not ?

Hi.

I'd like to send a command
regsvr32 /u  ***.dll

but only if it is registered.
Is there a way to find out programmatically ?

Thanks in advance.
Avatar of 2266180
2266180
Flag of United States of America image

I found this:
http://www.developerfusion.co.uk/show/3479/
and another idea:
http://experts.about.com/q/Visual-Basic-1048/DLL-OCX-Registered.htm
and another thread:
http://forums.winamp.com/showthread.php?threadid=181974 (didn't read throu)

you could also try to move the dll, or to rename it and trap error
Avatar of Russell Libby

Have you checked out the tip on my site:

http://users.adelphia.net/~rllibby/delphitips/tip8.html

regarding programmatically registering / unregistering a library? You can use this class to determine if a dll exposes the required functions, and there is no problem with unregistering a library that is not registered (most just remove any registry keys they created). The functions return an HRESULT (no error messages, exceptions), so you choose how you want to handle the return, if at all.

Regards,
Russell
Avatar of CodedK

ASKER

Ciuly thanks, i've read the articles, the source code in DeveloperFusion (Is it in C ?)
probably talks about looking if a dll can be loaded, if it is available...(Maybe i'm wrong...).
But mine is a windows component, its available.
I'd like to learn the current state.

Russell i've tracked the registry changes (registering/unregistering the dll)...
You are right, i can do without regsrv. I can just change the registry keys with you "RegTransfer" unit.

Just to be on the safe side i'd like to try COMREG unit ...
Can you give me an example of how to :
Check if it is available, load it and unload it ?

Thanks :)
ASKER CERTIFIED SOLUTION
Avatar of Russell Libby
Russell Libby
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CodedK

ASKER

Thank you both :)

Russell it works perfect, i can handle the messages now which is good :)
But more or less it does the same thing as the code in DeveloperFusion, it checks
for the existence of the file...
If it manage to load it then ok it exists... Anyway i can track it through registry and then load itwith your
unit  :)