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
- PropertyItem.cs
- BasicCellRelation.cs
- PerformanceCounterPermission.cs
- DesignerRegion.cs
- InheritablePropertyChangeInfo.cs
- DataBoundControlHelper.cs
- HitTestParameters.cs
- WindowsToolbar.cs
- BaseCollection.cs
- Message.cs
- FontUnitConverter.cs
- StructuredTypeEmitter.cs
- SqlServices.cs
- Calendar.cs
- MatrixTransform3D.cs
- PackagePart.cs
- InfoCardSymmetricCrypto.cs
- StandardOleMarshalObject.cs
- AutoResizedEvent.cs
- _RequestLifetimeSetter.cs
- XmlQueryRuntime.cs
- SimpleRecyclingCache.cs
- InternalConfigEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- InternalCache.cs
- InputScopeManager.cs
- AuthenticatingEventArgs.cs
- _TimerThread.cs
- MarshalByValueComponent.cs
- CoreChannel.cs
- FullTextState.cs
- BufferedReceiveManager.cs
- PropertyEmitterBase.cs
- MsmqAppDomainProtocolHandler.cs
- DataGridRowAutomationPeer.cs
- ClockGroup.cs
- AttachedAnnotationChangedEventArgs.cs
- CompModSwitches.cs
- WebPartAddingEventArgs.cs
- IDReferencePropertyAttribute.cs
- BaseConfigurationRecord.cs
- EntityParameter.cs
- DesignerVerb.cs
- TableItemProviderWrapper.cs
- ProgressiveCrcCalculatingStream.cs
- FontSource.cs
- cookieexception.cs
- XhtmlConformanceSection.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- DESCryptoServiceProvider.cs
- Rect.cs
- GroupDescription.cs
- ModelChangedEventArgsImpl.cs
- QilDataSource.cs
- DockPanel.cs
- figurelengthconverter.cs
- ScriptingRoleServiceSection.cs
- DataGridViewRowStateChangedEventArgs.cs
- RequestChannelBinder.cs
- GridViewColumn.cs
- SessionSwitchEventArgs.cs
- PointConverter.cs
- AttachedAnnotationChangedEventArgs.cs
- Color.cs
- DynamicEntity.cs
- InteropBitmapSource.cs
- StringPropertyBuilder.cs
- Debugger.cs
- XmlFileEditor.cs
- DragCompletedEventArgs.cs
- XmlILModule.cs
- TypeSystem.cs
- JoinTreeSlot.cs
- HitTestParameters.cs
- SqlCommandSet.cs
- MemberMaps.cs
- ProcessThreadCollection.cs
- IFormattable.cs
- RenderData.cs
- DataSourceControl.cs
- PolicyConversionContext.cs
- Switch.cs
- AssemblyNameUtility.cs
- PassportAuthenticationEventArgs.cs
- DBSchemaRow.cs
- CaretElement.cs
- PathGeometry.cs
- TypeUtil.cs
- PrintControllerWithStatusDialog.cs
- HandoffBehavior.cs
- Rules.cs
- ConnectionManager.cs
- FieldBuilder.cs
- ToolStripContentPanelRenderEventArgs.cs
- ListViewItem.cs
- Translator.cs
- _ListenerAsyncResult.cs
- EntityDataSourceChangingEventArgs.cs
- StandardCommands.cs
- DesignTimeResourceProviderFactoryAttribute.cs