Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- EndpointAddress10.cs
- HwndKeyboardInputProvider.cs
- GestureRecognizer.cs
- ClientUrlResolverWrapper.cs
- SqlDataSourceView.cs
- Version.cs
- TableLayoutSettings.cs
- ControlHelper.cs
- ObjectNavigationPropertyMapping.cs
- OleStrCAMarshaler.cs
- Error.cs
- _CookieModule.cs
- AssemblyHash.cs
- RedBlackList.cs
- ComboBoxItem.cs
- VisualBasicHelper.cs
- FunctionImportElement.cs
- AsymmetricSignatureDeformatter.cs
- ProcessRequestArgs.cs
- BrushMappingModeValidation.cs
- ReflectTypeDescriptionProvider.cs
- ItemCollection.cs
- Interlocked.cs
- figurelengthconverter.cs
- StylusPointProperty.cs
- PreservationFileReader.cs
- HtmlTableCell.cs
- DecimalAnimationUsingKeyFrames.cs
- smtppermission.cs
- FixedSOMTextRun.cs
- WebRequestModuleElementCollection.cs
- StrongNameMembershipCondition.cs
- PreProcessor.cs
- ExpressionsCollectionConverter.cs
- QilBinary.cs
- CommandConverter.cs
- ExtenderProviderService.cs
- GridLength.cs
- GifBitmapDecoder.cs
- ExpressionList.cs
- SpecialNameAttribute.cs
- HttpRawResponse.cs
- DynamicPhysicalDiscoSearcher.cs
- ListParaClient.cs
- XmlProcessingInstruction.cs
- Fault.cs
- SharedUtils.cs
- ListQueryResults.cs
- SelectionHighlightInfo.cs
- ResourceManager.cs
- ButtonPopupAdapter.cs
- SqlProfileProvider.cs
- FragmentNavigationEventArgs.cs
- WorkflowEnvironment.cs
- TwoPhaseCommit.cs
- CompositeControl.cs
- ChtmlMobileTextWriter.cs
- UIElementHelper.cs
- ResXDataNode.cs
- RotateTransform.cs
- RecommendedAsConfigurableAttribute.cs
- wgx_sdk_version.cs
- SizeF.cs
- SoapSchemaImporter.cs
- QueryParameter.cs
- WorkflowItemsPresenter.cs
- DomNameTable.cs
- HotCommands.cs
- BindingWorker.cs
- mediaclock.cs
- _AuthenticationState.cs
- ScaleTransform3D.cs
- DrawingServices.cs
- ReferenceService.cs
- DataControlImageButton.cs
- BamlLocalizableResource.cs
- CodeTypeMember.cs
- FacetDescription.cs
- BaseDataBoundControl.cs
- GZipUtils.cs
- DragEventArgs.cs
- QuaternionValueSerializer.cs
- Polygon.cs
- NetNamedPipeSecurityMode.cs
- CollectionEditor.cs
- DelegatingConfigHost.cs
- ObjectStateFormatter.cs
- Helper.cs
- XmlHierarchicalDataSourceView.cs
- SettingsAttributes.cs
- DefaultExpressionVisitor.cs
- FlowLayoutSettings.cs
- FormsAuthenticationTicket.cs
- DataGridViewDataConnection.cs
- CheckBoxBaseAdapter.cs
- ReceiveContext.cs
- UrlPropertyAttribute.cs
- Stylesheet.cs
- CharacterBufferReference.cs
- CodeRegionDirective.cs