Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / AccessibleTech / longhorn / Automation / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GradientBrush.cs
- DataSourceCollectionBase.cs
- ProtocolReflector.cs
- BamlStream.cs
- ObjectListCommandEventArgs.cs
- DbConnectionStringBuilder.cs
- ToolStripSystemRenderer.cs
- GenericQueueSurrogate.cs
- DisableDpiAwarenessAttribute.cs
- ClientSponsor.cs
- ConfigurationElementCollection.cs
- TimeSpan.cs
- ScriptHandlerFactory.cs
- DirectoryGroupQuery.cs
- DataControlFieldCollection.cs
- ColorPalette.cs
- BufferedReadStream.cs
- PrintingPermissionAttribute.cs
- DbConnectionPoolOptions.cs
- ServiceBehaviorElementCollection.cs
- CompositeFontFamily.cs
- EdmItemCollection.cs
- Method.cs
- DiscoveryClientChannelBase.cs
- Wow64ConfigurationLoader.cs
- OleDbParameterCollection.cs
- FontEditor.cs
- ComNativeDescriptor.cs
- SiteMapSection.cs
- HtmlProps.cs
- DataBoundControlDesigner.cs
- Cursors.cs
- GatewayDefinition.cs
- VBCodeProvider.cs
- TreeView.cs
- ReflectPropertyDescriptor.cs
- VirtualDirectoryMappingCollection.cs
- BitmapData.cs
- ToolStripOverflow.cs
- AsymmetricKeyExchangeFormatter.cs
- SQLMoney.cs
- NullableLongMinMaxAggregationOperator.cs
- SqlDataSourceFilteringEventArgs.cs
- AssociationType.cs
- GeneralTransform.cs
- BitSet.cs
- PermissionSetTriple.cs
- PolicyValidationException.cs
- SetIterators.cs
- AppDomainUnloadedException.cs
- NGCSerializer.cs
- Registry.cs
- XPathExpr.cs
- TypeDescriptionProvider.cs
- Pick.cs
- ReceiveSecurityHeaderElementManager.cs
- PhysicalFontFamily.cs
- Vector3DAnimationBase.cs
- EdmProviderManifest.cs
- Compress.cs
- AdornedElementPlaceholder.cs
- ThreadInterruptedException.cs
- SamlAuthenticationStatement.cs
- BufferedStream.cs
- StopRoutingHandler.cs
- ModelVisual3D.cs
- SamlAuthorityBinding.cs
- SignedInfo.cs
- Types.cs
- AppLevelCompilationSectionCache.cs
- ChangePassword.cs
- DrawingContext.cs
- IPPacketInformation.cs
- Attributes.cs
- TransformPatternIdentifiers.cs
- UpdatePanelTriggerCollection.cs
- SequenceFullException.cs
- SiteMapNodeItemEventArgs.cs
- InstanceKeyNotReadyException.cs
- DebuggerAttributes.cs
- AbstractSvcMapFileLoader.cs
- ListViewItem.cs
- XmlDocumentSerializer.cs
- ProtocolsSection.cs
- PasswordRecovery.cs
- WsdlBuildProvider.cs
- serverconfig.cs
- OleDbTransaction.cs
- ProfileBuildProvider.cs
- PointConverter.cs
- SoapServerMethod.cs
- OptimizedTemplateContent.cs
- NativeMethods.cs
- Dump.cs
- DataGridViewCellMouseEventArgs.cs
- Queue.cs
- MasterPageCodeDomTreeGenerator.cs
- DataControlCommands.cs
- CachedBitmap.cs
- ZoneMembershipCondition.cs