Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / UIAutomation / UIAutomationClient / MS / Internal / Automation / SafeHandles.cs / 1 / 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
- DialogResultConverter.cs
- ImageKeyConverter.cs
- NativeMethods.cs
- UnsafeNativeMethods.cs
- SafeTimerHandle.cs
- XPathAncestorIterator.cs
- DeviceContext2.cs
- SplitContainer.cs
- PathParser.cs
- ContextMenu.cs
- TreeNodeBindingCollection.cs
- XmlReaderSettings.cs
- TreeNodeConverter.cs
- BindingManagerDataErrorEventArgs.cs
- CompositeCollectionView.cs
- DesignTimeVisibleAttribute.cs
- ConfigurationLockCollection.cs
- HostedAspNetEnvironment.cs
- AuthenticationManager.cs
- RuleSetReference.cs
- TypeSchema.cs
- SolidColorBrush.cs
- ValidationResult.cs
- _ConnectStream.cs
- BindingElement.cs
- CfgParser.cs
- SwitchLevelAttribute.cs
- InplaceBitmapMetadataWriter.cs
- BooleanExpr.cs
- FolderNameEditor.cs
- CodeDesigner.cs
- RuntimeIdentifierPropertyAttribute.cs
- SqlErrorCollection.cs
- EventSinkHelperWriter.cs
- DayRenderEvent.cs
- QueueAccessMode.cs
- GridViewRow.cs
- ObjectStateFormatter.cs
- WindowsListViewGroup.cs
- DesignTimeParseData.cs
- SecondaryViewProvider.cs
- FileSecurity.cs
- ComponentManagerBroker.cs
- TailCallAnalyzer.cs
- UnknownBitmapEncoder.cs
- TextRangeEditTables.cs
- RequiredFieldValidator.cs
- SizeChangedEventArgs.cs
- SecurityHelper.cs
- ClientEventManager.cs
- EntityUtil.cs
- XmlAtomicValue.cs
- DefaultParameterValueAttribute.cs
- DiscoveryReferences.cs
- TemplateContentLoader.cs
- SecurityPolicySection.cs
- ConstructorBuilder.cs
- _ProxyChain.cs
- GroupStyle.cs
- Registry.cs
- SoapMessage.cs
- TextOptions.cs
- SoapServerProtocol.cs
- IpcManager.cs
- WebPartCatalogCloseVerb.cs
- CodeSubDirectoriesCollection.cs
- Zone.cs
- PrintPageEvent.cs
- DbProviderFactories.cs
- DataSourceSelectArguments.cs
- Matrix.cs
- NativeActivityContext.cs
- IndexedEnumerable.cs
- SafeViewOfFileHandle.cs
- PersonalizableTypeEntry.cs
- IconHelper.cs
- ScaleTransform.cs
- SHA256.cs
- DataControlFieldCell.cs
- HtmlInputImage.cs
- ChildDocumentBlock.cs
- AbandonedMutexException.cs
- OdbcConnectionOpen.cs
- HeaderUtility.cs
- AuthenticationModuleElementCollection.cs
- BindingExpression.cs
- UnmanagedHandle.cs
- DNS.cs
- RemoteWebConfigurationHostStream.cs
- DesignTimeParseData.cs
- Point3DCollectionConverter.cs
- BlobPersonalizationState.cs
- Paragraph.cs
- AspCompat.cs
- ToolboxItemFilterAttribute.cs
- XPathDocumentBuilder.cs
- DataGridViewControlCollection.cs
- TaiwanCalendar.cs
- XmlAttributeCache.cs
- PasswordDeriveBytes.cs