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
- OleDbConnectionInternal.cs
- TabRenderer.cs
- RuntimeVariableList.cs
- WebService.cs
- exports.cs
- DefaultSettingsSection.cs
- DeferredRunTextReference.cs
- SecurityKeyIdentifier.cs
- SqlXml.cs
- TypeForwardedFromAttribute.cs
- WebServiceHandlerFactory.cs
- XmlWrappingReader.cs
- RecipientInfo.cs
- TabItemWrapperAutomationPeer.cs
- ThicknessKeyFrameCollection.cs
- PagesSection.cs
- ProxyAttribute.cs
- CredentialSelector.cs
- FieldToken.cs
- StylusEditingBehavior.cs
- CompilationRelaxations.cs
- FlowPosition.cs
- GradientBrush.cs
- SelfIssuedSamlTokenFactory.cs
- FormatterConverter.cs
- EntityConnection.cs
- Int32EqualityComparer.cs
- ClonableStack.cs
- Decorator.cs
- TemplateComponentConnector.cs
- PreservationFileReader.cs
- ContainerUIElement3D.cs
- DataGridViewComboBoxCell.cs
- XmlILIndex.cs
- SimpleHandlerBuildProvider.cs
- HttpResponse.cs
- ApplicationContext.cs
- PathGradientBrush.cs
- KeysConverter.cs
- InputScopeNameConverter.cs
- HttpCapabilitiesBase.cs
- MenuItemAutomationPeer.cs
- Timer.cs
- Misc.cs
- DrawingAttributesDefaultValueFactory.cs
- FollowerQueueCreator.cs
- Table.cs
- PerformanceCounter.cs
- ConfigurationLoaderException.cs
- CodeArrayCreateExpression.cs
- StateMachineAction.cs
- HasCopySemanticsAttribute.cs
- ApplicationHost.cs
- NamespaceEmitter.cs
- DataBoundLiteralControl.cs
- Constant.cs
- OracleEncoding.cs
- CompilerError.cs
- EventData.cs
- GridViewUpdateEventArgs.cs
- MsmqIntegrationBindingCollectionElement.cs
- SecurityHelper.cs
- SafeBitVector32.cs
- Completion.cs
- hwndwrapper.cs
- CryptoStream.cs
- LabelEditEvent.cs
- NativeMethods.cs
- SubMenuStyleCollection.cs
- GcSettings.cs
- GlyphShapingProperties.cs
- CookielessHelper.cs
- LockingPersistenceProvider.cs
- CodeTypeDeclarationCollection.cs
- ProtocolsSection.cs
- EndpointNameMessageFilter.cs
- OpCellTreeNode.cs
- StreamUpgradeAcceptor.cs
- KeyManager.cs
- ListView.cs
- RecordManager.cs
- Menu.cs
- RelationshipConverter.cs
- HealthMonitoringSectionHelper.cs
- XhtmlConformanceSection.cs
- _NativeSSPI.cs
- HandlerBase.cs
- FillErrorEventArgs.cs
- CodeTypeReferenceExpression.cs
- TargetControlTypeAttribute.cs
- ServiceX509SecurityTokenProvider.cs
- PrimarySelectionGlyph.cs
- AuthenticationServiceManager.cs
- WebResponse.cs
- AuthenticateEventArgs.cs
- SqlCrossApplyToCrossJoin.cs
- SqlNotificationEventArgs.cs
- ContentHostHelper.cs
- LambdaCompiler.Expressions.cs
- StringPropertyBuilder.cs