You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.7 KiB
123 lines
3.7 KiB
<?xml version="1.0"?> |
|
<Template originator = "Mathias Simmack" created = "01/06/06" lastModified = "04/29/07"> |
|
|
|
<!-- Template Header --> |
|
<TemplateConfiguration> |
|
<!-- |
|
|
|
Template.Project.SharedAddin.Name = Shared Add-in |
|
Template.Project.SharedAddin.Description = Creates a shared add-in for COM applications |
|
--> |
|
|
|
<Name>${res:Templates.Project.SharedAddin.Name}</Name> |
|
<Category>C#</Category> |
|
<Icon>C#.Project.Library</Icon> |
|
<Description>${res:Templates.Project.SharedAddin.Description}</Description> |
|
<SupportedTargetFrameworks>v2.0</SupportedTargetFrameworks> |
|
</TemplateConfiguration> |
|
|
|
<!-- Actions --> |
|
<Actions> |
|
<Open filename = "Connect.cs"/> |
|
</Actions> |
|
|
|
<!-- Template Content --> |
|
<Project language="C#"> |
|
<ProjectItems> |
|
<Reference Include="System" /> |
|
<Reference Include="System.Xml" /> |
|
<Reference Include="System.Data" /> |
|
<Reference Include="Extensibility" /> |
|
</ProjectItems> |
|
|
|
<PropertyGroup> |
|
<OutputType>Library</OutputType> |
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
<RegisterForComInterop>true</RegisterForComInterop> |
|
</PropertyGroup> |
|
|
|
<Files> |
|
<File name="Connect.cs"><![CDATA[${StandardHeader.C#} |
|
namespace ${StandardNamespace} |
|
{ |
|
using System; |
|
using System.Runtime.InteropServices; |
|
using Extensibility; |
|
|
|
|
|
#region Creating an Add-in for Office ... |
|
|
|
// First of all, make sure the "Register for COM Interop" flag in your project |
|
// options is enabled. Create and add a reference to the Office core |
|
// tlbimp %CommonProgramFiles%\Microsoft Shared\Office12\mso.dll |
|
// /out:Microsoft.Office.Interop.dll |
|
// |
|
// Then add some code, compile the assembly and register it with |
|
// regasm ${StandardNamespace}.dll |
|
// |
|
// |
|
// Now create a new Registry key for the Office application, you want to |
|
// connect to |
|
// HKLM\Software\Microsoft\Visio\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\Word\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\Excel\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\Outlook\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\Publisher\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\Access\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\PowerPoint\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\FrontPage\Addins\${StandardNamespace}.Connect |
|
// HKLM\Software\Microsoft\Office\MS Project\Addins\${StandardNamespace}.Connect |
|
// |
|
// Now create this 3 values |
|
// LoadBehavior (DWORD) = 3 |
|
// Description (String) = a descriptive string for your add-in |
|
// FriendlyName (String) = a name |
|
// |
|
// If you don't want to use your add-in anymore, remove those Registry entries and |
|
// unregister the assembly with |
|
// regasm ${StandardNamespace}.dll /u |
|
// |
|
// |
|
// The best way, doing these registration steps, is a Setup project. |
|
|
|
#endregion |
|
|
|
|
|
[GuidAttribute("${GUID}"), ProgId("${StandardNamespace}.Connect")] |
|
[ComVisible(true)] |
|
public class Connect : Object, Extensibility.IDTExtensibility2 |
|
{ |
|
public Connect() |
|
{ |
|
} |
|
|
|
public void OnConnection(object application, ext_ConnectMode ConnectMode, object AddInInst, ref System.Array custom) |
|
{ |
|
applicationObject = application; |
|
addinInstance = AddInInst; |
|
} |
|
|
|
public void OnDisconnection(ext_DisconnectMode RemoveMode, ref System.Array custom) |
|
{ |
|
} |
|
|
|
public void OnAddInsUpdate(ref System.Array custom) |
|
{ |
|
} |
|
|
|
public void OnStartupComplete(ref System.Array custom) |
|
{ |
|
} |
|
|
|
public void OnBeginShutdown(ref System.Array custom) |
|
{ |
|
} |
|
|
|
private object applicationObject; |
|
private object addinInstance; |
|
} |
|
}]]></File> |
|
<File name="Properties\AssemblyInfo.cs" src="DefaultAssemblyInfo.cs"/> |
|
</Files> |
|
</Project> |
|
</Template>
|
|
|