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
- TextEndOfSegment.cs
- ResXBuildProvider.cs
- ProtocolsConfiguration.cs
- RegexInterpreter.cs
- HttpInputStream.cs
- ReadOnlyCollection.cs
- AnnotationComponentManager.cs
- DataRow.cs
- PointCollectionValueSerializer.cs
- DataStreamFromComStream.cs
- DetailsViewRow.cs
- RegexStringValidatorAttribute.cs
- FullTextLine.cs
- DbXmlEnabledProviderManifest.cs
- ObjectStateEntryDbDataRecord.cs
- LiteralTextContainerControlBuilder.cs
- ButtonBaseAutomationPeer.cs
- WebPartConnectionsEventArgs.cs
- SystemIcmpV4Statistics.cs
- OciHandle.cs
- TaskFormBase.cs
- WsdlBuildProvider.cs
- DataGridViewColumnEventArgs.cs
- XPathNavigatorReader.cs
- IsolatedStorageFilePermission.cs
- TypeKeyValue.cs
- XmlSerializerSection.cs
- EncryptedPackage.cs
- UserControl.cs
- GifBitmapEncoder.cs
- CodeMemberMethod.cs
- XmlAttributeCollection.cs
- XPathSelectionIterator.cs
- NativeMethods.cs
- HtmlShimManager.cs
- ConfigXmlComment.cs
- WebMessageEncodingBindingElement.cs
- GridView.cs
- PropertyPath.cs
- WebHttpSecurity.cs
- ProcessThread.cs
- Visual3D.cs
- XamlSerializer.cs
- AddInProcess.cs
- AutoGeneratedField.cs
- DefinitionUpdate.cs
- SplineKeyFrames.cs
- StringSorter.cs
- XmlBinaryReader.cs
- AssertFilter.cs
- MemoryRecordBuffer.cs
- EntitySetDataBindingList.cs
- Pair.cs
- PartialList.cs
- StringSource.cs
- DataGridViewSelectedRowCollection.cs
- InternalEnumValidator.cs
- PenLineJoinValidation.cs
- GridViewColumnHeader.cs
- DescriptionAttribute.cs
- AutoResizedEvent.cs
- WCFModelStrings.Designer.cs
- ListViewInsertEventArgs.cs
- AppModelKnownContentFactory.cs
- RenderContext.cs
- SimpleFieldTemplateFactory.cs
- WorkflowViewService.cs
- DetailsViewDesigner.cs
- CodeParameterDeclarationExpressionCollection.cs
- SortFieldComparer.cs
- TextViewDesigner.cs
- XPathAncestorIterator.cs
- CodeNamespace.cs
- RegistryKey.cs
- FastEncoderWindow.cs
- ToolStripRendererSwitcher.cs
- DataBindEngine.cs
- File.cs
- RootProfilePropertySettingsCollection.cs
- HttpInputStream.cs
- ButtonField.cs
- TraceEventCache.cs
- SkinBuilder.cs
- BamlCollectionHolder.cs
- PropertyDescriptor.cs
- DataObjectMethodAttribute.cs
- WebControlsSection.cs
- ArcSegment.cs
- TextEditorParagraphs.cs
- basemetadatamappingvisitor.cs
- NameValueFileSectionHandler.cs
- FormViewRow.cs
- ClientUrlResolverWrapper.cs
- QuadraticBezierSegment.cs
- CurrencyManager.cs
- Command.cs
- WSHttpBindingBaseElement.cs
- IPHostEntry.cs
- ResourcePermissionBase.cs
- _Events.cs