TRegSvr.exe, the Type Library Registration Tool

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Utilities Index

TRegSvr.exe is a tool for registering and unregistering COM/ActiveX servers and type libraries. TRegSvr.exe allows you to register just a type library. This is very handy for cases when you want Type Library marshalling but you might not necessarily want to register the object with COM. Using TRegSvr.exe to register just a type library for the current user can allow COM marshalling even for a user without Administrator rights. TRegSvr.exe is delivered with Delphi and is located in the product installation /bin directory.

You can use TRegSvr as an alternative to the following registration/unregistration actions (described in Registering a COM Object):

  • Register command (Run > ActiveX Server > Register)
  • Register for current user command (Run > ActiveX Server > Register for Current User)
  • Unregister command (Run > ActiveX Server > Unregister)
  • Regsvr32 command (documented in the accompanying help for the Microsoft Windows Software Development Kit)

Note: The IDE, being a 32-bit process, cannot register 64-bit in-proc/DLL servers (32-bit processes cannot load 64-bit DLLs). To register 64-bit in-proc servers, you must use the 64-bit version of TRegSvr.exe, located in $(BDS)\bin64\TRegSvr.exe.

Command Line Syntax

>tregsvr <options> <filename>

Options are the following command line options:

  • -u (unregister)
  • -q (quiet registration - no output)
  • -c (current user registration/unregistration)
  • -t (type library registration)
  • -s (side by side registration without a full path, for registering a Server whose client/consumer will reside in the same directory as the Server)

Filename is the name of the type library.

Command Line Help

To display the command line help, enter:


The following help is displayed by TRegSvr.exe:

Embarcadero Turbo Register Server -- COM Server Registration utility.
Version 1.3  Copyright (c) 1997-2010 Embarcadero Technologies, Inc.

Syntax: TREGSVR [options] filename
 -u  =  Unregister server or type library
 -q  =  Quiet (silent) operation
 -c  =  Register or unregister for current user
 -t  =  Register type library (default for .TLB files)
 -s  =  "Side By Side" type library registration (do not use full path)

Command Line Examples

The following command registers 'server.ocx' for all users:

   > tregsvr.exe  c:\dev\myprojects\server.ocx

This command unregisters the 'server.ocx' server (that is, the command undoes what the previous command did):

   > tregsvr.exe -u c:\dev\myprojects\server.ocx

The following command registers the Midas type library for the current user:

   > tregsvr.exe -t -c midas.dll

TIP: tregsvr.exe has an undocumented -v option that tells you whether a server is registered. The format is:

   tregsvr -v [-c] ServerName

The specified name can be a partial name. For example, the following command displays all servers containing the string 'msxml':

  > tregsvr -v msxml

The previous command generates the following output on a typical Windows installation, indicating that one matching server was found:

Embarcadero Turbo Register Server -- COM Server Registration utility.
Version 1.3  Copyright (c) 1997-2010 Embarcadero Technologies, Inc.

Searching for typelibrary entries matching "msxml4" in HKLM
(1)  : C:\Windows\system32\msxml4.dll
TLB  : {F5078F18-C551-11D3-89B9-0000F81FE221}
DESC : Microsoft XML, v4.0 (Version 4.0)
CLSID: {88D969C0-F192-11D4-A65F-0040963251E5}
CLSID: {88D969C1-F192-11D4-A65F-0040963251E5}
CLSID: {88D969C4-F192-11D4-A65F-0040963251E5}
CLSID: {88D969C5-F192-11D4-A65F-0040963251E5}
CLSID: {88D969C6-F192-11D4-A65F-0040963251E5}
PRGID: Msxml2.DOMDocument.4.0
PRGID: Msxml2.FreeThreadedDOMDocument.4.0
PRGID: Msxml2.DSOControl.4.0
PRGID: Msxml2.ServerXMLHTTP.4.0
Found 1 entries matching "msxml4" out of 561

See Also