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
- DataGridViewCheckBoxCell.cs
- DataGridViewColumnCollection.cs
- SqlFormatter.cs
- InstallerTypeAttribute.cs
- ChangeNode.cs
- SafeNativeMethods.cs
- DefaultWorkflowTransactionService.cs
- Command.cs
- MembershipValidatePasswordEventArgs.cs
- SelectedGridItemChangedEvent.cs
- TypeGeneratedEventArgs.cs
- DecimalAnimationBase.cs
- InvalidWMPVersionException.cs
- RowUpdatedEventArgs.cs
- SystemDiagnosticsSection.cs
- Interop.cs
- PieceDirectory.cs
- WeakEventManager.cs
- XmlWellformedWriter.cs
- DbInsertCommandTree.cs
- SafeWaitHandle.cs
- ScriptingJsonSerializationSection.cs
- XmlAnyElementAttribute.cs
- RangeBase.cs
- ResponseBodyWriter.cs
- ApplicationInterop.cs
- StrokeDescriptor.cs
- IdentitySection.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- DataSvcMapFileSerializer.cs
- ToolStripRenderEventArgs.cs
- DesignerActionMethodItem.cs
- WeakReference.cs
- SqlServices.cs
- UpdatePanel.cs
- CodeMethodReturnStatement.cs
- AnnotationComponentChooser.cs
- RunInstallerAttribute.cs
- ResizeGrip.cs
- ErrorWrapper.cs
- StandardBindingElement.cs
- UrlPropertyAttribute.cs
- ListViewContainer.cs
- CurrentChangedEventManager.cs
- SqlTriggerContext.cs
- SetIterators.cs
- ResourceReader.cs
- CalendarAutoFormatDialog.cs
- _emptywebproxy.cs
- XmlSchemaAppInfo.cs
- TransformPatternIdentifiers.cs
- CodeAttributeArgument.cs
- LessThanOrEqual.cs
- ColorBlend.cs
- RuntimeConfigLKG.cs
- DataGridTableStyleMappingNameEditor.cs
- StylusPointCollection.cs
- SafeFileMappingHandle.cs
- FamilyMap.cs
- hresults.cs
- DictionaryBase.cs
- ParameterBuilder.cs
- PublisherMembershipCondition.cs
- MemoryFailPoint.cs
- Html32TextWriter.cs
- XmlILOptimizerVisitor.cs
- DataServiceProviderMethods.cs
- Transform3DGroup.cs
- TreeViewImageIndexConverter.cs
- DelegatingTypeDescriptionProvider.cs
- GridPattern.cs
- Lease.cs
- SecureStringHasher.cs
- ObservableCollection.cs
- BamlTreeMap.cs
- RichTextBoxConstants.cs
- TableCellCollection.cs
- TypeSystem.cs
- DesignUtil.cs
- ListBoxAutomationPeer.cs
- ListBoxItemAutomationPeer.cs
- AutomationPatternInfo.cs
- BinaryObjectReader.cs
- AsnEncodedData.cs
- WebPartMovingEventArgs.cs
- BaseCodeDomTreeGenerator.cs
- FontConverter.cs
- ResXResourceWriter.cs
- WebMessageBodyStyleHelper.cs
- XmlSerializerNamespaces.cs
- BindingExpressionUncommonField.cs
- ExpressionDumper.cs
- ClientSideQueueItem.cs
- RemoteWebConfigurationHostServer.cs
- Encoder.cs
- StartFileNameEditor.cs
- TextStore.cs
- DataControlCommands.cs
- Item.cs
- ProgressBar.cs