Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / UIAutomation / UIAutomationClient / MS / Internal / Automation / SafeHandles.cs / 1305600 / SafeHandles.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Various SafeHandles used by UIA // //--------------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Windows.Automation; using System.Windows.Automation.Provider; // PRESHARP: In order to avoid generating warnings about unkown message numbers and unknown pragmas. #pragma warning disable 1634, 1691 namespace MS.Internal.Automation { internal sealed class SafeNodeHandle : SafeHandle { // Called by P/Invoke when returning SafeHandles // (Also used by UiaCoreApi to create invalid handles.) internal SafeNodeHandle() : base(IntPtr.Zero, true) { } // No need to provide a finalizer - SafeHandle's critical finalizer will // call ReleaseHandle for you. public override bool IsInvalid { get { return handle == IntPtr.Zero; } } override protected bool ReleaseHandle() { return UiaCoreApi.UiaNodeRelease(handle); } } // Internal Class that wraps the IntPtr to the Pattern internal sealed class SafePatternHandle : SafeHandle { // Called by P/Invoke when returning SafeHandles // (Also used by UiaCoreApi to create invalid handles.) internal SafePatternHandle() : base(IntPtr.Zero, true) { } // No need to provide a finalizer - SafeHandle's critical finalizer will // call ReleaseHandle for you. public override bool IsInvalid { get { return handle == IntPtr.Zero; } } override protected bool ReleaseHandle() { return UiaCoreApi.UiaPatternRelease(handle); } } // Internal Class that wraps the IntPtr to the Event internal sealed class SafeEventHandle : SafeHandle { internal SafeEventHandle() : base(IntPtr.Zero, true) { } public override bool IsInvalid { get { return handle == IntPtr.Zero; } } override protected bool ReleaseHandle() { UiaCoreApi.UiaRemoveEvent(handle); return true; } } } // 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. // // // // Description: Various SafeHandles used by UIA // //--------------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Windows.Automation; using System.Windows.Automation.Provider; // PRESHARP: In order to avoid generating warnings about unkown message numbers and unknown pragmas. #pragma warning disable 1634, 1691 namespace MS.Internal.Automation { internal sealed class SafeNodeHandle : SafeHandle { // Called by P/Invoke when returning SafeHandles // (Also used by UiaCoreApi to create invalid handles.) internal SafeNodeHandle() : base(IntPtr.Zero, true) { } // No need to provide a finalizer - SafeHandle's critical finalizer will // call ReleaseHandle for you. public override bool IsInvalid { get { return handle == IntPtr.Zero; } } override protected bool ReleaseHandle() { return UiaCoreApi.UiaNodeRelease(handle); } } // Internal Class that wraps the IntPtr to the Pattern internal sealed class SafePatternHandle : SafeHandle { // Called by P/Invoke when returning SafeHandles // (Also used by UiaCoreApi to create invalid handles.) internal SafePatternHandle() : base(IntPtr.Zero, true) { } // No need to provide a finalizer - SafeHandle's critical finalizer will // call ReleaseHandle for you. public override bool IsInvalid { get { return handle == IntPtr.Zero; } } override protected bool ReleaseHandle() { return UiaCoreApi.UiaPatternRelease(handle); } } // Internal Class that wraps the IntPtr to the Event internal sealed class SafeEventHandle : SafeHandle { internal SafeEventHandle() : base(IntPtr.Zero, true) { } public override bool IsInvalid { get { return handle == IntPtr.Zero; } } override protected bool ReleaseHandle() { UiaCoreApi.UiaRemoveEvent(handle); return true; } } } // 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
- StaticExtension.cs
- AudienceUriMode.cs
- CharConverter.cs
- Timeline.cs
- Main.cs
- ListControlStringCollectionEditor.cs
- Zone.cs
- SafeFileMapViewHandle.cs
- RawStylusActions.cs
- ConditionValidator.cs
- XmlWrappingWriter.cs
- ContractMapping.cs
- Debug.cs
- AppDomainInfo.cs
- Size3DConverter.cs
- WCFModelStrings.Designer.cs
- BaseTreeIterator.cs
- StopStoryboard.cs
- ContextMenuStrip.cs
- UTF32Encoding.cs
- SqlDuplicator.cs
- ScalarType.cs
- ResolveNameEventArgs.cs
- MouseButtonEventArgs.cs
- PrintingPermission.cs
- HScrollBar.cs
- TextFragmentEngine.cs
- PropertyEmitterBase.cs
- UnsafeNativeMethods.cs
- UnSafeCharBuffer.cs
- JsonReader.cs
- VBCodeProvider.cs
- ServiceDescription.cs
- SystemTcpStatistics.cs
- Completion.cs
- ButtonRenderer.cs
- SafeHandles.cs
- WebPartHelpVerb.cs
- CustomPopupPlacement.cs
- ProviderConnectionPoint.cs
- WsdlBuildProvider.cs
- _AuthenticationState.cs
- MarkupCompiler.cs
- UTF7Encoding.cs
- SiteMapProvider.cs
- _TransmitFileOverlappedAsyncResult.cs
- PropertyAccessVisitor.cs
- SystemColors.cs
- Vector3DCollection.cs
- WebPartConnectionsCancelVerb.cs
- StatusBarDrawItemEvent.cs
- ListItemCollection.cs
- COM2TypeInfoProcessor.cs
- XslTransform.cs
- control.ime.cs
- BasicViewGenerator.cs
- TimersDescriptionAttribute.cs
- HtmlControlAdapter.cs
- EntityDataSourceContextCreatedEventArgs.cs
- WindowsSlider.cs
- PropertyValue.cs
- TextBreakpoint.cs
- DataBoundLiteralControl.cs
- KeyValueSerializer.cs
- UnsafeNativeMethods.cs
- Int64AnimationBase.cs
- FusionWrap.cs
- _FixedSizeReader.cs
- XmlDocumentType.cs
- LoaderAllocator.cs
- WebPermission.cs
- WebResourceUtil.cs
- WebSysDescriptionAttribute.cs
- Comparer.cs
- StringPropertyBuilder.cs
- HtmlControlPersistable.cs
- WpfSharedXamlSchemaContext.cs
- WindowsIPAddress.cs
- RotateTransform3D.cs
- ApplyImportsAction.cs
- MatchNoneMessageFilter.cs
- CacheDependency.cs
- MenuItemBindingCollection.cs
- Cursor.cs
- CompareInfo.cs
- ObjectStateFormatter.cs
- QueryCursorEventArgs.cs
- IndentedWriter.cs
- GraphicsContext.cs
- Hash.cs
- HotSpotCollection.cs
- GridViewAutomationPeer.cs
- CollectionChangedEventManager.cs
- BuildProvider.cs
- BinHexEncoder.cs
- MultiTrigger.cs
- COM2IPerPropertyBrowsingHandler.cs
- LayoutUtils.cs
- XmlAnyElementAttribute.cs
- RelationshipConverter.cs