Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
registertypelib (oleaut32)
The RegisterTypeLib function adds information about a type library to the registry.

C# Signatures:

static extern int RegisterTypeLib(ITypeLib ptlib,
   [MarshalAs(UnmanagedType.BStr)] string szFullPath,
   [MarshalAs(UnmanagedType.BStr)] string szHelpDir);

[DllImport("oleaut32.dll", PreserveSig=false)]
static extern void RegisterTypeLib(ITypeLib ptlib,
   [MarshalAs(UnmanagedType.BStr)] string szFullPath,
   [MarshalAs(UnmanagedType.BStr)] string szHelpDir);

VB.Net Signature:

Declare Unicode Function RegisterTypeLib Lib "oleaut32.dll" (ByVal ptlib As System.Runtime.InteropServices.ComTypes.ITypeLib, ByVal szFullPath As String, ByVal szHelpDir As String) As Integer

VB 6 Signature:

Declare Function RegisterTypeLib Lib "oleaut32.dll" (ByVal pTLB As Object, szFullPath As Byte, szHelpFile As Byte) As Long

User-Defined Types:

For the ITypeLib parameter in C#, you can use System.Runtime.InteropServices.UCOMITypeLib, already defined in mscorlib.dll. Note that in v2.0 (Whidbey) of the .NET Framework, this interface has been deprecated in favor of System.Runtime.InteropServices.ComTypes.ITypeLib.

In VB.Net you can substitute System.Runtime.InteropServices.ComTypes.ITypeLib2 or System.Runtime.InteropServices.UCOMITypeLib for System.Runtime.InteropServices.ComTypes.ITypeLib, defined in mscorlib.dll.


In C# The first signature returns the raw HRESULT. The second signature throws an exception when a failure HRESULT is returned.

Ensure that you use the same parameter type in LoadTypeLib in either language.

Tips & Tricks:

Please add some!

Sample Code: (See UnRegisterTypeLib for VB.Net sample code.)

Alternative Managed API:

Do you know one? Please contribute it!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version