Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if a DLL or OCX is already registered 4

Status
Not open for further replies.

suoirotciv

Programmer
Dec 3, 2002
205
PH
is there a way that i can check if a DLL or OCX is already registered?

and if that is possible, can i use VB to register a DLL/OCX?

i ask this question, cause we have lots of computers here in our office, and it's really frustrating to check every PC. so i'm planning to use my application's on load to check if some DLL/OCX is already registered or not.

Please pardon the grammar.
Not good in english.
 
I think you can check in the registry for an entry of the DLL in HKEY_CLASSES_ROOT.

e.g.

I have just created a DLL, registered it and there is not an entry named TestDLL.Project1 in HKEY_CLASSES_ROOT. So I guess the idea would be to search for the name of the DLL and if it is found then it is registered. Maybe someone can clarify if this is correct?

As for registering a DLL you could use the shell command

i.e.

Shell ("C:\WINNT\SYSTEM32\CMD.EXE /c regsvr32 c:\test.dll")
 
okies . . . i have tried ur shell command . . . and it works fine . . . but ofcourse we dont want to bother our users with message pop-ups . . . like

"DllRegisterServer in test.dll succeeded."

can i trap this messages . . . so the users will not be able to see it . . .

and not to forget . . . thanks for your suggestions

Please pardon the grammar.
Not good in english.
 
To be honest I'm not sure if you can hide it as it is being returned from the regsvr32 program. A quick (although not very reliable) way would to maybe use sendkeys?

Somebody else may know a way to hide it but I cant think of a way. Sorry!
 
Regsvr32 /S <filename> will register the DLL without the message.

as for capturing the result, I don't kow but maybe you could see what the exit code for the shell command is?

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
hoowahhhh!!!


that was great . . . so it's really true that two heads are better than one . . . thanks to both of you (ca8msm/mattKnight)

so i just need to check if a certain dll is already registered . . .

Please pardon the grammar.
Not good in english.
 
hey ca8msm . . . now you also know how to hide it . . . [wink]

Please pardon the grammar.
Not good in english.
 
Okay . . . maybe i'm just going to change my question . . .

&quot;IS IT HARMFUL TO UNREGISTER/REGISTER A DLL?&quot;

&quot;I MEAN, EVERYTIME MY APPLICATION RUN, I WILL UNREGISTER THEN REGISTER A DLL.&quot;

Please pardon the grammar.
Not good in english.
 
Yeah thanks for the Regsvr32 hide argument mattknight.

suoirotciv - I don't think it's actually harmful but a bit unnecessary maybe.

Have you tried searching the HKEY_CLASSES_ROOT for the entry first?

Is there also a reason why you can't run a setup package for your program on each machine as this will install the dll and therefore every machine will haev it registered each time you load your program.

Or maybe a script in the network logon for each user that would register it?

 
Whilst we've often said in this forum that the DLLs (and OCXs) that you can create in VB are COM libraries, and therefore do not export functions that can be called like the rest of the Windows API, this is not quite true.

There are two functions that every library created by VB (ActiveX DLL, ActiveX EXE, and OCX) does export.

Why am I bothering to mention this? Because to the two functions are:

[tt]DllRegisterServer

[/tt]and

[tt]DllUnregisterServer

In other words, the libraries export the functions necessary for doing a self-registration or unregistration

I'd post my code, but since it is based on part on a Microsoft example and since that example contains some further explanation I'll just point you at the original:
 
Well thats certainly an easier solution. Thanks strongm.
 
well . . . i was not able to reply yesterday . . .

but once again . . . thanks to all of you . . . and also to strongm for that very nice information . . .

Please pardon the grammar.
Not good in english.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top