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
- SerializationEventsCache.cs
- BaseParser.cs
- ExternalCalls.cs
- ConditionalAttribute.cs
- PointAnimationBase.cs
- MouseEvent.cs
- TextContainer.cs
- DataGridViewComboBoxEditingControl.cs
- DocumentOrderComparer.cs
- XmlReturnReader.cs
- SBCSCodePageEncoding.cs
- RelationalExpressions.cs
- TheQuery.cs
- SeparatorAutomationPeer.cs
- NamedPipeDuplicateContext.cs
- DirectoryInfo.cs
- ConstraintStruct.cs
- Lease.cs
- DecimalAnimation.cs
- MenuItemBindingCollection.cs
- SchemaImporterExtensionsSection.cs
- MDIControlStrip.cs
- HwndProxyElementProvider.cs
- DispatcherFrame.cs
- ImageBrush.cs
- InvalidAsynchronousStateException.cs
- FontSizeConverter.cs
- TabControlEvent.cs
- TypefaceCollection.cs
- SchemaImporter.cs
- EntityContainerEmitter.cs
- TableLayoutRowStyleCollection.cs
- WebPartZoneCollection.cs
- KeyFrames.cs
- OdbcStatementHandle.cs
- SocketInformation.cs
- SiteMapSection.cs
- NameScope.cs
- DecimalAnimation.cs
- NameNode.cs
- ApplicationContext.cs
- OdbcEnvironmentHandle.cs
- ViewBase.cs
- ImportCatalogPart.cs
- QilDataSource.cs
- QueryCursorEventArgs.cs
- WinEventHandler.cs
- Vector3DCollectionConverter.cs
- Permission.cs
- SqlBinder.cs
- HttpModuleActionCollection.cs
- TypefaceMetricsCache.cs
- CodeMethodInvokeExpression.cs
- SrgsGrammarCompiler.cs
- BuildProvider.cs
- UnionCqlBlock.cs
- ProfileGroupSettings.cs
- WebPartMenuStyle.cs
- XmlReader.cs
- BitSet.cs
- HtmlFormAdapter.cs
- ComboBoxAutomationPeer.cs
- BlurBitmapEffect.cs
- MessageDecoder.cs
- MinMaxParagraphWidth.cs
- DefaultParameterValueAttribute.cs
- PixelFormats.cs
- TreeNodeStyleCollectionEditor.cs
- Ref.cs
- Quad.cs
- TextureBrush.cs
- ServicesUtilities.cs
- ComplexTypeEmitter.cs
- PropertyFilterAttribute.cs
- InvariantComparer.cs
- XmlJsonWriter.cs
- KeyInfo.cs
- MethodBuilderInstantiation.cs
- LoadWorkflowCommand.cs
- ParagraphResult.cs
- MruCache.cs
- XmlDocumentFragment.cs
- NotCondition.cs
- EntityTypeEmitter.cs
- PreloadHost.cs
- IISMapPath.cs
- FontStretches.cs
- DbParameterHelper.cs
- BookmarkList.cs
- CreateInstanceBinder.cs
- SoapDocumentMethodAttribute.cs
- SymLanguageType.cs
- TableRow.cs
- InvokeProviderWrapper.cs
- XmlLinkedNode.cs
- FileSystemInfo.cs
- FrameworkContentElement.cs
- WebServiceParameterData.cs
- ActivityInfo.cs
- ZipArchive.cs