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
- BaseUriHelper.cs
- AmbientLight.cs
- EditingCommands.cs
- ProcessExitedException.cs
- UpnEndpointIdentityExtension.cs
- ControlEvent.cs
- PropertyGeneratedEventArgs.cs
- CodeAccessSecurityEngine.cs
- Trace.cs
- SqlCacheDependency.cs
- Win32.cs
- SapiInterop.cs
- cookiecontainer.cs
- RectAnimationUsingKeyFrames.cs
- _DisconnectOverlappedAsyncResult.cs
- TableRow.cs
- IntSecurity.cs
- FilteredXmlReader.cs
- DocumentPageView.cs
- PageBreakRecord.cs
- SessionEndedEventArgs.cs
- SqlBulkCopyColumnMappingCollection.cs
- ProviderException.cs
- ViewCellRelation.cs
- WrapPanel.cs
- DBCommandBuilder.cs
- ResourcesBuildProvider.cs
- EdmFunctionAttribute.cs
- ImageInfo.cs
- RequestCachingSection.cs
- ResourcesGenerator.cs
- WorkflowViewManager.cs
- CompiledQuery.cs
- AddInControllerImpl.cs
- DataPager.cs
- AmbiguousMatchException.cs
- SmiMetaDataProperty.cs
- StreamGeometry.cs
- CancelEventArgs.cs
- XPathChildIterator.cs
- D3DImage.cs
- DataGridViewCellEventArgs.cs
- XMLDiffLoader.cs
- ContainerUtilities.cs
- ResourceExpressionEditor.cs
- DXD.cs
- DictionaryBase.cs
- WindowHideOrCloseTracker.cs
- StyleSelector.cs
- MetadataSource.cs
- TypeBuilder.cs
- MissingSatelliteAssemblyException.cs
- TransformCollection.cs
- AttachedPropertyMethodSelector.cs
- ImageSourceTypeConverter.cs
- DBDataPermission.cs
- ResourceContainer.cs
- ReservationNotFoundException.cs
- ScriptingProfileServiceSection.cs
- codemethodreferenceexpression.cs
- PauseStoryboard.cs
- EndCreateSecurityTokenRequest.cs
- FlagsAttribute.cs
- Camera.cs
- SqlBuffer.cs
- NativeMethods.cs
- OutputCacheSection.cs
- KnownTypeAttribute.cs
- StreamInfo.cs
- DatePickerAutomationPeer.cs
- SerializationBinder.cs
- _ProxyRegBlob.cs
- ListBox.cs
- GenericUriParser.cs
- DocumentReference.cs
- MetadataArtifactLoader.cs
- XpsResource.cs
- FormsAuthenticationModule.cs
- FlowLayout.cs
- SourceFileInfo.cs
- EntityReference.cs
- CompilerTypeWithParams.cs
- PanelDesigner.cs
- ObjectStateEntry.cs
- FormsAuthenticationEventArgs.cs
- SplitterEvent.cs
- WebBrowserNavigatingEventHandler.cs
- SynchronizedDispatch.cs
- WebPartZone.cs
- CalendarSelectionChangedEventArgs.cs
- DoubleStorage.cs
- Rotation3D.cs
- OracleParameterBinding.cs
- AbstractExpressions.cs
- XPathNodeHelper.cs
- DWriteFactory.cs
- OlePropertyStructs.cs
- PolyLineSegment.cs
- Highlights.cs
- MethodBuilderInstantiation.cs