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
- PeerNameRegistration.cs
- FileUtil.cs
- BrushMappingModeValidation.cs
- DataGridViewCellValidatingEventArgs.cs
- HyperLinkColumn.cs
- EpmTargetPathSegment.cs
- XPathExpr.cs
- SliderAutomationPeer.cs
- CalendarDataBindingHandler.cs
- ActivityDesigner.cs
- ClipboardProcessor.cs
- SQLCharsStorage.cs
- assemblycache.cs
- DefaultValueTypeConverter.cs
- HwndAppCommandInputProvider.cs
- CollectionView.cs
- MultipleViewProviderWrapper.cs
- ObjectDesignerDataSourceView.cs
- ServiceRouteHandler.cs
- fixedPageContentExtractor.cs
- DiscoveryExceptionDictionary.cs
- WindowsScrollBar.cs
- ThrowHelper.cs
- PermissionRequestEvidence.cs
- LateBoundBitmapDecoder.cs
- WebAdminConfigurationHelper.cs
- ReturnEventArgs.cs
- NavigationWindow.cs
- DataGridViewCellPaintingEventArgs.cs
- SafeRightsManagementSessionHandle.cs
- KnownAssembliesSet.cs
- OutputScopeManager.cs
- ScaleTransform.cs
- EDesignUtil.cs
- FlatButtonAppearance.cs
- _CookieModule.cs
- XmlProcessingInstruction.cs
- SystemFonts.cs
- ResourceDisplayNameAttribute.cs
- Matrix3DConverter.cs
- CompletedAsyncResult.cs
- Stack.cs
- SpoolingTask.cs
- EventLogPermission.cs
- SqlDependency.cs
- GB18030Encoding.cs
- ReachSerializationCacheItems.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- TokenBasedSet.cs
- JavaScriptString.cs
- NestPullup.cs
- BitStack.cs
- DispatchChannelSink.cs
- URI.cs
- ColumnCollection.cs
- DataColumnMapping.cs
- ItemMap.cs
- ConfigurationProperty.cs
- CustomMenuItemCollection.cs
- SubclassTypeValidatorAttribute.cs
- Slider.cs
- StylusDownEventArgs.cs
- WindowsPrincipal.cs
- NullableDecimalMinMaxAggregationOperator.cs
- MetadataUtilsSmi.cs
- ExtensibleClassFactory.cs
- CoreSwitches.cs
- HttpCachePolicy.cs
- ControlCollection.cs
- SqlMethodTransformer.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- CommonDialog.cs
- SystemColors.cs
- DirectoryInfo.cs
- ThreadPool.cs
- ManipulationStartingEventArgs.cs
- RegexFCD.cs
- InputMethod.cs
- DrawingBrush.cs
- ObservableDictionary.cs
- FieldToken.cs
- RangeValuePattern.cs
- ClientTargetCollection.cs
- HttpModuleAction.cs
- SurrogateSelector.cs
- ObjectList.cs
- CompositionAdorner.cs
- DetailsViewDeleteEventArgs.cs
- StrongNamePublicKeyBlob.cs
- PackWebRequestFactory.cs
- Primitive.cs
- FileDialog.cs
- EnumerableWrapperWeakToStrong.cs
- PrintControllerWithStatusDialog.cs
- BuilderPropertyEntry.cs
- TableItemStyle.cs
- PropertyChangedEventArgs.cs
- DataContractJsonSerializerOperationBehavior.cs
- SecUtil.cs
- hebrewshape.cs