# ActiveX Registration Options

An ActiveX build can be registered for all users or for the current user only, and need not be registered when it is built.

## Registration Location

Register ActiveX builds to `HKEY_LOCAL_MACHINE` or `HKEY_CURRENT_USER` option. While modern applications use `HKEY_CURRENT_USER`, for VBx compatibility components must be registered to `HKEY_LOCAL_MACHINE`. Note that this requires running as admin when registering.

## Build-Time Registration

Registration at build time is optional. The *Register DLL after build* setting in [Project Settings](/tB/IDE/Project-Settings.md#register-dll-after-build) lets you disable automatic registration, if for example you wanted to move the file first.

[ActiveX registration](/tB/IDE/Building/ActiveX-Registration.md) describes what the IDE shows when a build registers a DLL, the warning for a project that registers to `HKEY_LOCAL_MACHINE`, and what **Clean** removes.

## Custom Registration

In addition to the automatic registration/unregistration process that twinBASIC creates, you are able to define custom code to run. To do this, your project can include its own `DllRegisterServer()` and/or `DllUnregisterServer()` methods in a Standard Module. These will run *in addition* to the standard implementations of those functions the compiler inserts into a built ActiveX project. They should not be marked as DLL exports. A typical use for this would be for shell extensions, where additional registry entries are typically placed in a .reg file; you could use this feature instead so the .reg file is not needed. Example:

```tb check_build
Module Registration
    Public Function DllRegisterServer() As Boolean
    'Apply custom registrations
    Return True
    End Function

    Public Function DllUnregisterServer() As Boolean
    'Remove custom registrations
    Return True
    End Function
End Module
```



