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
- SpeechRecognitionEngine.cs
- TripleDES.cs
- AudioDeviceOut.cs
- CopyCodeAction.cs
- OdbcFactory.cs
- SafeNativeMethods.cs
- TemplateManager.cs
- AddInProcess.cs
- DataGridViewCellConverter.cs
- PageBuildProvider.cs
- NullNotAllowedCollection.cs
- LiteralDesigner.cs
- MetafileHeader.cs
- ContentValidator.cs
- DocumentGridPage.cs
- ReadOnlyDataSourceView.cs
- Calendar.cs
- rsa.cs
- SqlFunctionAttribute.cs
- ImageSource.cs
- InitializerFacet.cs
- ContainerControl.cs
- DataObject.cs
- EntityWithKeyStrategy.cs
- RootAction.cs
- ParserStack.cs
- EntityDataSource.cs
- KernelTypeValidation.cs
- ImageCodecInfoPrivate.cs
- CreateParams.cs
- Catch.cs
- PropertyExpression.cs
- DtrList.cs
- DbProviderFactoriesConfigurationHandler.cs
- XmlReaderDelegator.cs
- ArrayList.cs
- BitmapInitialize.cs
- SrgsOneOf.cs
- AssemblyNameEqualityComparer.cs
- XmlSortKey.cs
- Region.cs
- RealizedColumnsBlock.cs
- Rect.cs
- TCPClient.cs
- SharedPersonalizationStateInfo.cs
- MessageContractAttribute.cs
- Conditional.cs
- RawAppCommandInputReport.cs
- FieldToken.cs
- GraphicsPathIterator.cs
- TargetConverter.cs
- AppDomainFactory.cs
- Focus.cs
- XamlGridLengthSerializer.cs
- URLIdentityPermission.cs
- UrlMappingCollection.cs
- DataGridAddNewRow.cs
- Point3DAnimationUsingKeyFrames.cs
- ProviderUtil.cs
- InfiniteTimeSpanConverter.cs
- InvokeMethodActivityDesigner.cs
- QuotedPrintableStream.cs
- StartUpEventArgs.cs
- TextServicesProperty.cs
- Renderer.cs
- XamlRtfConverter.cs
- WorkflowInlining.cs
- DeobfuscatingStream.cs
- CmsUtils.cs
- WebPartTracker.cs
- DataGridViewCell.cs
- BufferedResponseStream.cs
- StringTraceRecord.cs
- HandledEventArgs.cs
- TextTreeTextElementNode.cs
- CngProperty.cs
- Constant.cs
- ParallelTimeline.cs
- BooleanFacetDescriptionElement.cs
- SqlInfoMessageEvent.cs
- ContentPathSegment.cs
- Freezable.cs
- XmlDownloadManager.cs
- versioninfo.cs
- ToolStripSettings.cs
- AsymmetricSignatureFormatter.cs
- WebRequestModuleElementCollection.cs
- Propagator.ExtentPlaceholderCreator.cs
- ZipIOLocalFileHeader.cs
- FindCriteriaApril2005.cs
- EncodingFallbackAwareXmlTextWriter.cs
- GeneratedCodeAttribute.cs
- VoiceChangeEventArgs.cs
- WebPageTraceListener.cs
- DisposableCollectionWrapper.cs
- DLinqAssociationProvider.cs
- CdpEqualityComparer.cs
- PropertyManager.cs
- datacache.cs
- OutputCacheProfileCollection.cs