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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tired of Error 429 - Self Register it in your app

ActiveX DLLs

Tired of Error 429 - Self Register it in your app

by  zarkon4  Posted    (Edited  )
Found this useful little hint on Microsoft's site and I have encountered this problem and have seen posts from people who have as well.

The following is code in which you can automatically register your DLL or OCX at runtime, It has proven useful in the environment in which I develop. The code would go into your application.

Whenever you register or unregister a DLL the regsvr32 utility just calls out a function from withing the DLL itself. You may also use "DllUnRegisterServer" declared as a function as well.

Declare Function RegMyDLL Lib "<Path>\MyDLL.DLL" Alias _
"DllRegisterServer" () as Long


private sub TestForDLL

On Error goto ErrorHandler

dim RegMyDLLAttempted as Boolean
dim objSomeObject as Object

'if the dll is not registered then it will generate
' an error 429 at the following line.
set objSomeObject = CreateObject("MyDLL.Class")


set objSomeObject=nothing

exit sub

ErrorHandler:
If err.number=429 then
if RegMyDLLAttempted then
'error in registering do something else
else
RegMyDLL
RegMyDLLAttempted=True
Resume
end if

end sub
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top