Registering a COM Plug-in

banner art

Previous Next

Registering a COM Plug-in

If you create the plug-in using ATL, the following command is added to the build environment so that the plug-in is automatically registered when you build it:

regsvr32 /s /c "$(TargetPath)" 

To register a plug-in on a computer other than that on which the plug-in was built, enter the preceding command on the command line. TargetPath contains the path of the .dll or .exe file that contains your plug-in. To remove a plug-in from the registry, enter the following command:

regsvr32 /u "TargetPath"

When you use ATL to create a plug-in, you can use a registry script to add information to the appropriate registry entry. The registry script is stored in a file with an .rgs extension. The following script automatically adds registry information for a sample event notification plug-in.

HKCR
{
  EventTest.EventPlugin.1 = s 'EventPlugin Class'
  {
    CLSID = s '{8A7D7A8F-69C1-4FE0-BAA1-56A7EA48F68D}'
  }
  EventTest.EventPlugin = s 'EventPlugin Class'
  {
    CLSID = s '{8A7D7A8F-69C1-4FE0-BAA1-56A7EA48F68D}'
    CurVer = s 'EventTest.EventPlugin.1'
  }
  NoRemove CLSID
  {
    ForceRemove {8A7D7A8F-69C1-4FE0-BAA1-56A7EA48F68D} = 
                        s 'EventPlugin Class'
    {
      ProgID = s 'EventTest.EventPlugin.1'
      VersionIndependentProgID = s 'EventTest.EventPlugin'
      InprocServer32 = s '%MODULE%'
      {
        val ThreadingModel = s 'Apartment'
      }
      val AppID = s '%APPID%'
      'TypeLib' = s '{AA7C50DF-3B11-47B5-9E21-AECF77A378BF}'
      ForceRemove Properties
      {
        val Author = s 'Company_Name'
        val Name = s 'Sample Event Notification Plugin'
        val Copyright = s 'Copyright 2002'
        val MMCMoniker = s 'CLSID:{DCC0FCEE-DD79-4957-BB91-E4E490FE00D0}'
        val UnsupportedLoadTypes = d '2'
      }
    }
  }
}

HKLM 
{
  NoRemove SOFTWARE
  {
    NoRemove Microsoft
    {
      NoRemove 'Windows Media'
      {
        NoRemove Server
        {
          NoRemove RegisteredPlugins
          {
            NoRemove 'Event Notification and Authorization'
            {
              ForceRemove {8A7D7A8F-69C1-4FE0-BAA1-56A7EA48F68D} 
                              = s 'Sample Event Notification Plugin'
              {
              }
            }
          }
        }
      }
    }
  }
}

See Also

Previous Next