User Interface (UI) Plugin Registration for COM UI Plugins

Once you build a COM UI plugin component, you must register it both in the Windows registry and with a plugin point in the Ansys Orbit Determination Tool Kit (ODTK) application. After registering the COM UI plugin properly, you can deploy it to other computers for use by others.

Registering plugins in the Windows registry

Because each COM UI plugin component is a COM object, it must follow certain COM paradigms. Most importantly, you must register each component for use in the Windows registry with a unique GUID (Globally Unique Identifier). You must have administrative rights to add components to the Windows registry.

Visual Studio provides the GuidGen.exe program that generates unique GUIDs. Access the GUID creation tool from the Tools menu in Visual Studio. If you don't have Visual Studio, download the Windows Script Component Wizard from www.msdn.com/downloads; this can also generate GUIDs. It is very important not to have more than one component registered in the Windows registry with the same GUID.

Before registering the components, if you have Microsoft AntiSpyware application actively running, you will have to perform one of the following tasks:

  • Allow the running of these scripts via the MS AntiSpyware applications options menu.
  • Run the script, and when it asks for it to allow the script, check the box indicating "Remember this action".

Compiled plugins

Compiled components are contained in a dynamic link library with a filename having an extension 'dll'. To register the component, open a command window by going to the Start menu, typing "C", and clicking the Command Prompt app. Change your directory (using the cd command) to that of the file. At the command prompt, type "regsvr32 YOUR_UIPLUGINNAME". For example:

regsvr32 YOUR_UIPLUGINNAME.dll

Registration on 64-bit computers

When using regsvr32 on a 64-bit machine, it is important to know whether the COM object is built using a 32- or 64-bit architecture. To register a 32-bit-built COM object, you must use the 32-bit version of regsvr32. Normally this is in C:\Windows\SysWOW64. By default, 64-bit computers use the 64-bit version of regsvr32, so you should use

C:\Windows\SysWOW64\regsvr32.exe YOUR_UIPLUGINNAME

when registering 32-bit COM objects.

Registration with a plugin point in ODTK application (i.e., category registration)

To register your COM UI plugin with the hosting environment, you need to list it in an XML registration file.

The registration file has the following form:

<?xml version = "1.0"?>
<AGIRegistry version = "1.0">
<CategoryRegistry>
<Category Name = "UiPlugins">
<UiPlugin DisplayName = "Optional Display Name" ProgID = "YOUR_ProgID" File = "Filepath/NameofComponent.dll" DisplayName = "YOUR_DISPLAYNAME">
</Category>
</CategoryRegistry>
</AGIRegistry>

Tags (e.g., Plugin) and attributes (e.g., DisplayName) are case sensitive.

You may choose to create a new XML file for each plugin you create, or you may choose to use one file to register two or more plugins (even two or more plugins to two or more categories). Each file is capable of registering two or more plugins (here shown using the <UiPlugins> tag) and registering two or more categories (here shown using the <Category> tag). You need not register all plugins of the same Category in the same file. The ProgID is the Program Identifier you chose to associate with your plugin's GUID.

Display name

In COM UI plugins, the DisplayName is used as a user-friendly shorthand for the ProgID listed. You may choose any DisplayName, but it must be unique among all registered plugins of the same category. See the sample registration files for the official category name of a plugin point.

Version information

You can add version information to the XML manifest file, as shown in the following COM UI plugin example (not actual).

 
 <UiPlugin ProgID="Agi.Ui.Plugins.CSharp.Basic" 
     File="C:\Source\DeveloperKit\CodeSamples\Extend\Ui.Plugins\CSharp\Basic\bin\Debug\Agi.Ui.Plugins.CSharp.Basic.dll"      DisplayName="Basic CSharp Plugin">
<VersionInfo Version="Version Number">
<Publisher>Company Name</Publisher>
<SupportUrl>http://companyname.com/UIPlugin/</SupportUrl>
<Creator>Developer Name</Creator>
<Description>Description of UI Plugin</Description>
</VersionInfo> </UiPlugin>

You can view this version information from the ODTK GUI by selecting Preferences->UI Plugins from the Edit menu and clicking Details... under Advanced Options.

Manifest location

When the host application starts, it searches for XML files contained in identified folders and registers all plugins declared in each XML file found. Any changes made to these files after startup will not take effect until the next time the application starts. The ODTK application looks for XML plugin registration files in <Install_Dir>\Plugins.

XML registration files located in <Install_Dir>\Plugins are available for every user.

Related Topics: