Registering ActiveX component from code

Registering a ActiveX component involves using the regsvr32 tool. But, it would be weird to use it from the middle of your code. There is a workaround solution to this by using the following declare statement:

Public Declare Function .DLLSelfRegister Lib “vb6stkit.dll” (By Val lp.dllName As String) As Integer

But, this involves shipping vb6stkit.dll and its dependencies.
Instead, I believed that there should be a more robust way of solving this issue and I came up with this idea which also won the best code snippet in

 This code is still valid in the .NET world.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: