Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / PtsHost / UnmanagedHandle.cs / 1 / UnmanagedHandle.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: UnmanagedHandle.cs // // Description: Definition for Unmanaged Handle. Provides identity (handle), // which can be used in unmanaged world. // // History: // 05/02/2003 : grzegorz - moving from Avalon branch. // //--------------------------------------------------------------------------- using System; namespace MS.Internal.PtsHost { ////// Provides identity (handle), which can be used in unmanaged world. /// If object is passed into unmanaged world, and there is a need to identify /// that object later on, its class should inherit from UnmanagedHandle. /// internal class UnmanagedHandle : IDisposable { ////// Constructor. Used when object derives from UnmanagedHandle. /// /// /// PTS context /// protected UnmanagedHandle(PtsContext ptsContext) { _ptsContext = ptsContext; _handle = ptsContext.CreateHandle(this); } ////// Dispose the object and release handle. /// public virtual void Dispose() { try { _ptsContext.ReleaseHandle(_handle); } finally { _handle = IntPtr.Zero; } } ////// Handle of an object. /// internal IntPtr Handle { get { return _handle; } } private IntPtr _handle; ////// PtsContext that is the owner of the handle. /// It is required to store it here for Dispose. When Dispose is called /// it is not always possible to get instance of PtsContext that /// has been used to create this handle. /// internal PtsContext PtsContext { get { return _ptsContext; } } private readonly PtsContext _ptsContext; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: UnmanagedHandle.cs // // Description: Definition for Unmanaged Handle. Provides identity (handle), // which can be used in unmanaged world. // // History: // 05/02/2003 : grzegorz - moving from Avalon branch. // //--------------------------------------------------------------------------- using System; namespace MS.Internal.PtsHost { ////// Provides identity (handle), which can be used in unmanaged world. /// If object is passed into unmanaged world, and there is a need to identify /// that object later on, its class should inherit from UnmanagedHandle. /// internal class UnmanagedHandle : IDisposable { ////// Constructor. Used when object derives from UnmanagedHandle. /// /// /// PTS context /// protected UnmanagedHandle(PtsContext ptsContext) { _ptsContext = ptsContext; _handle = ptsContext.CreateHandle(this); } ////// Dispose the object and release handle. /// public virtual void Dispose() { try { _ptsContext.ReleaseHandle(_handle); } finally { _handle = IntPtr.Zero; } } ////// Handle of an object. /// internal IntPtr Handle { get { return _handle; } } private IntPtr _handle; ////// PtsContext that is the owner of the handle. /// It is required to store it here for Dispose. When Dispose is called /// it is not always possible to get instance of PtsContext that /// has been used to create this handle. /// internal PtsContext PtsContext { get { return _ptsContext; } } private readonly PtsContext _ptsContext; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FrameworkRichTextComposition.cs
- StateManagedCollection.cs
- PropertyPath.cs
- RectangleConverter.cs
- DocumentPageViewAutomationPeer.cs
- HostingEnvironmentException.cs
- NotImplementedException.cs
- IdentityNotMappedException.cs
- QuotedPrintableStream.cs
- StringBlob.cs
- Serializer.cs
- IODescriptionAttribute.cs
- QilPatternVisitor.cs
- EnumType.cs
- DebugView.cs
- Blend.cs
- FormatterServices.cs
- DispatcherEventArgs.cs
- InheritedPropertyChangedEventArgs.cs
- PenLineJoinValidation.cs
- StrongTypingException.cs
- CompressStream.cs
- HttpSysSettings.cs
- Encoder.cs
- FrameDimension.cs
- KeyValuePair.cs
- RangeValidator.cs
- RegexStringValidator.cs
- SupportsEventValidationAttribute.cs
- OAVariantLib.cs
- NumberSubstitution.cs
- WmpBitmapDecoder.cs
- CollectionType.cs
- ViewGenResults.cs
- NamedPipeProcessProtocolHandler.cs
- MinimizableAttributeTypeConverter.cs
- DataGridViewRowsAddedEventArgs.cs
- ICspAsymmetricAlgorithm.cs
- DES.cs
- JsonServiceDocumentSerializer.cs
- GroupByExpressionRewriter.cs
- ImportContext.cs
- RenderDataDrawingContext.cs
- TdsParser.cs
- NamespaceEmitter.cs
- HttpWebRequest.cs
- TextShapeableCharacters.cs
- UIAgentAsyncParams.cs
- ColumnMapVisitor.cs
- MaskedTextProvider.cs
- RewritingValidator.cs
- JoinGraph.cs
- DataControlFieldCollection.cs
- WebPartAddingEventArgs.cs
- TranslateTransform.cs
- IPipelineRuntime.cs
- LogExtentCollection.cs
- CacheDependency.cs
- FacetDescriptionElement.cs
- TableLayoutStyle.cs
- HtmlHead.cs
- SpAudioStreamWrapper.cs
- DateTimeFormat.cs
- ADMembershipUser.cs
- TreeViewImageIndexConverter.cs
- FontWeights.cs
- DataColumn.cs
- DataServiceHost.cs
- TraceLevelStore.cs
- XmlReflectionMember.cs
- AggregatePushdown.cs
- PeerNameResolver.cs
- AsyncOperation.cs
- DeploymentSection.cs
- ButtonBaseDesigner.cs
- ADMembershipUser.cs
- AttributeSetAction.cs
- HtmlTableRow.cs
- BindingsCollection.cs
- OdbcFactory.cs
- ChangeConflicts.cs
- IISUnsafeMethods.cs
- GridLength.cs
- ConnectionStringsSection.cs
- GeneralTransform2DTo3DTo2D.cs
- CompareInfo.cs
- Point3DCollection.cs
- Int32.cs
- AspProxy.cs
- _SslState.cs
- DecimalConverter.cs
- CodeSubDirectory.cs
- ToolStripContainer.cs
- DataRelationCollection.cs
- IdnMapping.cs
- XmlObjectSerializer.cs
- ImageCodecInfoPrivate.cs
- XmlSchemaAny.cs
- HitTestWithPointDrawingContextWalker.cs
- PowerModeChangedEventArgs.cs