1)build up a inprocess component project

2)Add a class named as CFBAddIn implemented the IFBAddIn Interface by using ATL Simple Object Wizard.CFBAddIn supports IsupportErrorInfo interface.

3)Add the functionality implementing the _IDTExtensibility2 event interface in the CFBAddIn class.The interface is decribed in the file C:/Program Files/Common Files/DESIGNER/MSADDNDR.TLB 

4)add these statements to FBAddIn.rgs file

HKCU

{

  Software

  {

    Microsoft

    {

      Office

      {

        Word

        {

          Addins

          {

            'WordAddInDemo.FBAddIn'

            {

              val FriendlyName = s 'WordAddInDemo.FBAddIn'

              val Description = s 'Word Custom Addin'

              val LoadBehavior = d '00000003'

              val CommandLineSafe = d '00000001'

            }

          }

        }

      }

    }

  }

}

5)press ctrl+f5 to run the dll,set the executable file path "D:/Program Files/Microsoft Office/OFFICE11"