Skip to content

Commit bf7dba6

Browse files
authored
Update msdn links and simplify relative links (dotnet#4895)
1 parent ff5964a commit bf7dba6

34 files changed

+269
-407
lines changed

docs/csharp/programming-guide/interop/walkthrough-office-programming.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ helpviewer_keywords:
1313
- "Office programming [C#]"
1414
- "Office programming [Visual Basic]"
1515
ms.assetid: 519cff31-f80b-4f0e-a56b-26358d0f8c51
16-
caps.latest.revision: 46
1716
author: "BillWagner"
1817
ms.author: "wiwagn"
1918
---
2019
# Walkthrough: Office Programming (C# and Visual Basic)
2120
Visual Studio offers features in C# and Visual Basic that improve Microsoft Office programming. Helpful C# features include named and optional arguments and return values of type `dynamic`. In COM programming, you can omit the `ref` keyword and gain access to indexed properties. Features in Visual Basic include auto-implemented properties, statements in lambda expressions, and collection initializers.
2221

23-
Both languages enable embedding of type information, which allows deployment of assemblies that interact with COM components without deploying primary interop assemblies (PIAs) to the user's computer. For more information, see [Walkthrough: Embedding Types from Managed Assemblies](http://msdn.microsoft.com/library/b28ec92c-1867-4847-95c0-61adfe095e21).
22+
Both languages enable embedding of type information, which allows deployment of assemblies that interact with COM components without deploying primary interop assemblies (PIAs) to the user's computer. For more information, see [Walkthrough: Embedding Types from Managed Assemblies](https://msdn.microsoft.com/library/b28ec92c-1867-4847-95c0-61adfe095e21).
2423

2524
This walkthrough demonstrates these features in the context of Office programming, but many of these features are also useful in general programming. In the walkthrough, you use an Excel Add-in application to create an Excel workbook. Next, you create a Word document that contains a link to the workbook. Finally, you see how to enable and disable the PIA dependency.
2625

@@ -205,8 +204,8 @@ You must have Microsoft Office Excel and Microsoft Office Word installed on your
205204
[Lambda Expressions (Visual Basic)](../../../visual-basic/programming-guide/language-features/procedures/lambda-expressions.md)
206205
[Lambda Expressions (C#)](../../../csharp/programming-guide/statements-expressions-operators/lambda-expressions.md)
207206
[How to: Use Indexed Properties in COM Interop Programming](../../../csharp/programming-guide/interop/how-to-use-indexed-properties-in-com-interop-rogramming.md)
208-
[Walkthrough: Embedding Type Information from Microsoft Office Assemblies](http://msdn.microsoft.com/library/85b55e05-bc5e-4665-b6ae-e1ada9299fd3)
209-
[Walkthrough: Embedding Types from Managed Assemblies](http://msdn.microsoft.com/library/b28ec92c-1867-4847-95c0-61adfe095e21)
210-
[Walkthrough: Creating Your First VSTO Add-in for Excel](http://msdn.microsoft.com/library/a855e2be-3ecf-4112-a7f5-ec0f7fad3b5f)
207+
[Walkthrough: Embedding Type Information from Microsoft Office Assemblies](https://msdn.microsoft.com/library/85b55e05-bc5e-4665-b6ae-e1ada9299fd3(v=vs.100))
208+
[Walkthrough: Embedding Types from Managed Assemblies](https://msdn.microsoft.com/library/b28ec92c-1867-4847-95c0-61adfe095e21)
209+
[Walkthrough: Creating Your First VSTO Add-in for Excel](https://msdn.microsoft.com/library/a855e2be-3ecf-4112-a7f5-ec0f7fad3b5f)
211210
[COM Interop](../../../visual-basic/programming-guide/com-interop/index.md)
212211
[Interoperability](../../../csharp/programming-guide/interop/index.md)

docs/framework/interop/com-callable-wrapper.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
---
22
title: "COM Callable Wrapper"
3-
ms.custom: ""
43
ms.date: "03/30/2017"
54
ms.prod: ".net-framework"
6-
ms.reviewer: ""
7-
ms.suite: ""
85
ms.technology:
96
- "dotnet-clr"
10-
ms.tgt_pltfrm: ""
117
ms.topic: "article"
128
dev_langs:
139
- "csharp"
@@ -20,7 +16,6 @@ helpviewer_keywords:
2016
- "interoperation with unmanaged code, COM wrappers"
2117
- "COM callable wrappers"
2218
ms.assetid: d04be3b5-27b9-4f5b-8469-a44149fabf78
23-
caps.latest.revision: 10
2419
author: "rpetrusha"
2520
ms.author: "ronpet"
2621
manager: "wpickett"
@@ -32,7 +27,7 @@ When a COM client calls a .NET object, the common language runtime creates the m
3227

3328
The runtime creates exactly one CCW for a managed object, regardless of the number of COM clients requesting its services. As the following illustration shows, multiple COM clients can hold a reference to the CCW that exposes the INew interface. The CCW, in turn, holds a single reference to the managed object that implements the interface and is garbage collected. Both COM and .NET clients can make requests on the same managed object simultaneously.
3429

35-
![COM callable wrapper](../../../docs/framework/interop/media/ccw.gif "ccw")
30+
![COM callable wrapper](./media/ccw.gif "ccw")
3631
Accessing .NET objects through COM callable wrapper
3732

3833
COM callable wrappers are invisible to other classes running within the .NET Framework. Their primary purpose is to marshal calls between managed and unmanaged code; however, CCWs also manage the object identity and object lifetime of the managed objects they wrap.
@@ -43,13 +38,14 @@ Accessing .NET objects through COM callable wrapper
4338
## Object Lifetime
4439
Unlike the .NET client it wraps, the CCW is reference-counted in traditional COM fashion. When the reference count on the CCW reaches zero, the wrapper releases its reference on the managed object. A managed object with no remaining references is collected during the next garbage-collection cycle.
4540

46-
## Simulating COM interfaces
47-
The [COM callable wrapper](../../../docs/framework/interop/com-callable-wrapper.md) (CCW) exposes all public, COM-visible interfaces, data types, and return values to COM clients in a manner that is consistent with COM's enforcement of interface-based interaction. For a COM client, invoking methods on a .NET Framework object is identical to invoking methods on a COM object.
41+
## Simulating COM interfaces
42+
43+
CCW exposes all public, COM-visible interfaces, data types, and return values to COM clients in a manner that is consistent with COM's enforcement of interface-based interaction. For a COM client, invoking methods on a .NET Framework object is identical to invoking methods on a COM object.
4844

4945
To create this seamless approach, the CCW manufactures traditional COM interfaces, such as **IUnknown** and **IDispatch**. As the following illustration shows, the CCW maintains a single reference on the .NET object that it wraps. Both the COM client and .NET object interact with each other through the proxy and stub construction of the CCW.
5046

51-
![COM interfaces](../../../docs/framework/interop/media/ccwwithinterfaces.gif "ccwwithinterfaces")
52-
Com interfaces and the COM callable wrapper
47+
![COM interfaces](./media/ccwwithinterfaces.gif "ccwwithinterfaces")
48+
COM interfaces and the COM callable wrapper
5349

5450
In addition to exposing the interfaces that are explicitly implemented by a class in the managed environment, the .NET Framework supplies implementations of the COM interfaces listed in the following table on behalf of the object. A .NET class can override the default behavior by providing its own implementation of these interfaces. However, the runtime always provides the implementation for the **IUnknown** and **IDispatch** interfaces.
5551

@@ -66,15 +62,15 @@ Com interfaces and the COM callable wrapper
6662

6763
|Interface|Description|
6864
|---------------|-----------------|
69-
|The (_*classname*) class interface|Interface, exposed by the runtime and not explicitly defined, that exposes all public interfaces, methods, properties, and fields that are explicitly exposed on a managed object.|
65+
|The (\_*classname*) class interface|Interface, exposed by the runtime and not explicitly defined, that exposes all public interfaces, methods, properties, and fields that are explicitly exposed on a managed object.|
7066
|**IConnectionPoint** and **IconnectionPointContainer**|Interface for objects that source delegate-based events (an interface for registering event subscribers).|
7167
|**IdispatchEx**|Interface supplied by the runtime if the class implements **IExpando**. The **IDispatchEx** interface is an extension of the **IDispatch** interface that, unlike **IDispatch**, enables enumeration, addition, deletion, and case-sensitive calling of members.|
7268
|**IEnumVARIANT**|Interface for collection-type classes, which enumerates the objects in the collection if the class implements **IEnumerable**.|
7369

7470
## Introducing the class interface
75-
The class interface, which is not explicitly defined in managed code, is an interface that exposes all public methods, properties, fields, and events that are explicitly exposed on the .NET object. This interface can be a dual or dispatch-only interface. The class interface receives the name of the .NET class itself, preceded by an underscore. For example, for class Mammal, the class interface is _Mammal.
71+
The class interface, which is not explicitly defined in managed code, is an interface that exposes all public methods, properties, fields, and events that are explicitly exposed on the .NET object. This interface can be a dual or dispatch-only interface. The class interface receives the name of the .NET class itself, preceded by an underscore. For example, for class Mammal, the class interface is \_Mammal.
7672

77-
For derived classes, the class interface also exposes all public methods, properties, and fields of the base class. The derived class also exposes a class interface for each base class. For example, if class Mammal extends class MammalSuperclass, which itself extends System.Object, the .NET object exposes to COM clients three class interfaces named _Mammal, _MammalSuperclass, and _Object.
73+
For derived classes, the class interface also exposes all public methods, properties, and fields of the base class. The derived class also exposes a class interface for each base class. For example, if class Mammal extends class MammalSuperclass, which itself extends System.Object, the .NET object exposes to COM clients three class interfaces named \_Mammal, \_MammalSuperclass, and \_Object.
7874

7975
For example, consider the following .NET class:
8076

@@ -101,7 +97,7 @@ public class Mammal
10197
}
10298
```
10399

104-
The COM client can obtain a pointer to a class interface named `_Mammal`, which is described in the type library that the [Type Library Exporter (Tlbexp.exe)](../../../docs/framework/tools/tlbexp-exe-type-library-exporter.md) tool generates. If the `Mammal` class implemented one or more interfaces, the interfaces would appear under the coclass.
100+
The COM client can obtain a pointer to a class interface named `_Mammal`, which is described in the type library that the [Type Library Exporter (Tlbexp.exe)](../tools/tlbexp-exe-type-library-exporter.md) tool generates. If the `Mammal` class implemented one or more interfaces, the interfaces would appear under the coclass.
105101

106102
```
107103
[odl, uuid(…), hidden, dual, nonextensible, oleautomation]
@@ -153,7 +149,7 @@ public class LoanApp : IExplicit {
153149

154150
The **ClassInterfaceType.None** value prevents the class interface from being generated when the class metadata is exported to a type library. In the preceding example, COM clients can access the `LoanApp` class only through the `IExplicit` interface.
155151

156-
### Avoid caching dispatch identifiers (DispIds).
152+
### Avoid caching dispatch identifiers (DispIds)
157153
Using the class interface is an acceptable option for scripted clients, Microsoft Visual Basic 6.0 clients, or any late-bound client that does not cache the DispIds of interface members. DispIds identify interface members to enable late binding.
158154

159155
For the class interface, generation of DispIds is based on the position of the member in the interface. If you change the order of the member and export the class to a type library, you will alter the DispIds generated in the class interface.
@@ -184,9 +180,7 @@ public class LoanApp : IAnother {
184180

185181
## See Also
186182
<xref:System.Runtime.InteropServices.ClassInterfaceAttribute>
187-
[COM Callable Wrapper](../../../docs/framework/interop/com-callable-wrapper.md)
188-
[COM Wrappers](../../../docs/framework/interop/com-wrappers.md)
189-
[Exposing .NET Framework Components to COM](../../../docs/framework/interop/exposing-dotnet-components-to-com.md)
190-
[Simulating COM Interfaces](http://msdn.microsoft.com/library/ad2ab959-e2be-411b-aaff-275c3fba606c)
191-
[Qualifying .NET Types for Interoperation](../../../docs/framework/interop/qualifying-net-types-for-interoperation.md)
192-
[Runtime Callable Wrapper](../../../docs/framework/interop/runtime-callable-wrapper.md)
183+
[COM Wrappers](com-wrappers.md)
184+
[Exposing .NET Framework Components to COM](exposing-dotnet-components-to-com.md)
185+
[Qualifying .NET Types for Interoperation](qualifying-net-types-for-interoperation.md)
186+
[Runtime Callable Wrapper](runtime-callable-wrapper.md)
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
---
22
title: "COM Wrappers"
3-
ms.custom: ""
43
ms.date: "03/30/2017"
54
ms.prod: ".net-framework"
6-
ms.reviewer: ""
7-
ms.suite: ""
85
ms.technology:
96
- "dotnet-clr"
10-
ms.tgt_pltfrm: ""
117
ms.topic: "article"
128
helpviewer_keywords:
139
- "wrapper classes"
@@ -17,7 +13,6 @@ helpviewer_keywords:
1713
- "interoperation with unmanaged code, COM wrappers"
1814
- "COM callable wrappers"
1915
ms.assetid: e56c485b-6b67-4345-8e66-fd21835a6092
20-
caps.latest.revision: 12
2116
author: "rpetrusha"
2217
ms.author: "ronpet"
2318
manager: "wpickett"
@@ -33,16 +28,16 @@ COM differs from the .NET Framework object model in several important ways:
3328

3429
- NET objects reside in memory managed by the .NET Framework execution environment. The execution environment can move objects around in memory for performance reasons and update all references to the objects it moves. Unmanaged clients, having obtained a pointer to an object, rely on the object to remain at the same location. These clients have no mechanism for dealing with an object whose location is not fixed.
3530

36-
To overcome these differences, the runtime provides wrapper classes to make both managed and unmanaged clients think they are calling objects within their respective environment. Whenever your managed client calls a method on a COM object, the runtime creates a [runtime callable wrapper](../../../docs/framework/interop/runtime-callable-wrapper.md) (RCW). RCWs abstract the differences between managed and unmanaged reference mechanisms, among other things. The runtime also creates a [COM callable wrapper](../../../docs/framework/interop/com-callable-wrapper.md) (CCW) to reverse the process, enabling a COM client to seamlessly call a method on a .NET object. As the following illustration shows, the perspective of the calling code determines which wrapper class the runtime creates.
31+
To overcome these differences, the runtime provides wrapper classes to make both managed and unmanaged clients think they are calling objects within their respective environment. Whenever your managed client calls a method on a COM object, the runtime creates a [runtime callable wrapper](runtime-callable-wrapper.md) (RCW). RCWs abstract the differences between managed and unmanaged reference mechanisms, among other things. The runtime also creates a [COM callable wrapper](com-callable-wrapper.md) (CCW) to reverse the process, enabling a COM client to seamlessly call a method on a .NET object. As the following illustration shows, the perspective of the calling code determines which wrapper class the runtime creates.
3732

38-
![COM wrapper overview](../../../docs/framework/interop/media/bidirectional.gif "bidirectional")
33+
![COM wrapper overview](media/bidirectional.gif "bidirectional")
3934
COM wrapper overview
4035

4136
In most cases, the standard RCW or CCW generated by the runtime provides adequate marshaling for calls that cross the boundary between COM and the .NET Framework. Using custom attributes, you can optionally adjust the way the runtime represents managed and unmanaged code.
4237

4338
## See Also
44-
[Advanced COM Interoperability](http://msdn.microsoft.com/library/3ada36e5-2390-4d70-b490-6ad8de92f2fb)
45-
[Runtime Callable Wrapper](../../../docs/framework/interop/runtime-callable-wrapper.md)
46-
[COM Callable Wrapper](../../../docs/framework/interop/com-callable-wrapper.md)
47-
[Customizing Standard Wrappers](http://msdn.microsoft.com/library/c40d089b-6a3c-41b5-a20d-d760c215e49d)
48-
[How to: Customize Runtime Callable Wrappers](http://msdn.microsoft.com/library/4a4bb3da-4d60-4517-99f2-78d46a681732)
39+
[Advanced COM Interoperability](https://msdn.microsoft.com/library/3ada36e5-2390-4d70-b490-6ad8de92f2fb(v=vs.100))
40+
[Runtime Callable Wrapper](runtime-callable-wrapper.md)
41+
[COM Callable Wrapper](com-callable-wrapper.md)
42+
[Customizing Standard Wrappers](https://msdn.microsoft.com/library/c40d089b-6a3c-41b5-a20d-d760c215e49d(v=vs.100))
43+
[How to: Customize Runtime Callable Wrappers](https://msdn.microsoft.com/library/4a4bb3da-4d60-4517-99f2-78d46a681732(v=vs.100))

0 commit comments

Comments
 (0)