Talk:TRegSvr.exe, the Type Library Registration Tool

From RAD Studio
Jump to: navigation, search

The one thing to highlight is that, unlike regsvr32, TRegSvr.exe allows one to register just a typelibrary. This is very handy for cases when you want Type Library marshalling but may not necessarily want to register the object with COM. And using TRegSvr.exe to register just a Type Library for the current user may allow COM marshalling even for a user without Administrator rights.

Here are some examples of using TRegSvr.exe:

The followin gcommand register 'server.ocx' for all users:

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


This command unregisters the 'server.ocx' server (i.e. it undoes what was done with the previous command):

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


The following command registers the Midas typelibrary for the current user:

   > tregsvr.exe -t -c midas.dll


TIPS: tregsvr.exe can also be used to find out if a server is registered via the undocumented -v option. The format is

   tregsvr -v [-c] ServerName

The name may be a partial name. For example, the following command displays all servers containing the string 'msxml4':

  > tregsvr -v msxml

On a typical Windows setup it generates the following output indicating that it found one matching server:

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.XMLHTTP.4.0
PRGID: Msxml2.ServerXMLHTTP.4.0
-------------------------------------------------------
Found 1 entries matching "msxml4" out of 561


Hello,

The line:

"-s (side by side registration without a full path, for type libraries that will be used only within their directory) "

is a little misleading. It's for registering a Server whose client/consumer will reside in the same directory as the Server. So it's not really for the type library but for the object itself. And the benefit is to be reaped by a Client residing 'side-by-side' (next to) the Server.


Reply/Response

Thank you, Bruneau, for your insightful review and addition of command line examples.

KrisHouser 17:43, 24 September 2010 (PDT)