Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ConcurrentBag.cs
- HotSpotCollection.cs
- SerializationInfoEnumerator.cs
- X509IssuerSerialKeyIdentifierClause.cs
- PathSegmentCollection.cs
- TypedTableBaseExtensions.cs
- BitmapCache.cs
- DataListItemEventArgs.cs
- StylusPlugInCollection.cs
- DependencyPropertyKey.cs
- HostedHttpRequestAsyncResult.cs
- RSAPKCS1SignatureDeformatter.cs
- PerfService.cs
- ValidatedControlConverter.cs
- Tuple.cs
- DynamicFilter.cs
- Types.cs
- SupportsEventValidationAttribute.cs
- ThemeInfoAttribute.cs
- StylusPoint.cs
- HtmlElement.cs
- PresentationAppDomainManager.cs
- InternalUserCancelledException.cs
- SocketAddress.cs
- ClientTargetCollection.cs
- RootProfilePropertySettingsCollection.cs
- FontCacheUtil.cs
- MouseEvent.cs
- keycontainerpermission.cs
- TextTreeObjectNode.cs
- MSAAEventDispatcher.cs
- RealizationContext.cs
- SecuritySessionServerSettings.cs
- SizeChangedInfo.cs
- ViewPort3D.cs
- QueryableFilterRepeater.cs
- AttributeUsageAttribute.cs
- ListComponentEditor.cs
- WebPart.cs
- CodeComment.cs
- StyleSelector.cs
- InternalsVisibleToAttribute.cs
- MarshalByValueComponent.cs
- AddInDeploymentState.cs
- RegexGroupCollection.cs
- ClockGroup.cs
- XsltCompileContext.cs
- DependencyObject.cs
- IncrementalCompileAnalyzer.cs
- FirewallWrapper.cs
- BamlLocalizationDictionary.cs
- ServiceOperationWrapper.cs
- OleDbSchemaGuid.cs
- InputBuffer.cs
- UrlAuthFailedErrorFormatter.cs
- ArgumentNullException.cs
- ISAPIRuntime.cs
- HexParser.cs
- FrameworkEventSource.cs
- FontStretches.cs
- ConnectivityStatus.cs
- TemplateControlParser.cs
- CompModSwitches.cs
- DataControlFieldCell.cs
- ActivityMarkupSerializationProvider.cs
- NamespaceEmitter.cs
- DynamicArgumentDesigner.xaml.cs
- SpeechDetectedEventArgs.cs
- SimpleMailWebEventProvider.cs
- TypeInitializationException.cs
- Vector3DAnimation.cs
- FormsAuthenticationEventArgs.cs
- TextAdaptor.cs
- GetPageCompletedEventArgs.cs
- SqlInternalConnectionTds.cs
- DelegateSerializationHolder.cs
- PhysicalAddress.cs
- StringSorter.cs
- ColumnCollection.cs
- HttpApplicationFactory.cs
- PartialClassGenerationTask.cs
- MimeObjectFactory.cs
- MenuCommandsChangedEventArgs.cs
- PolyBezierSegment.cs
- WebPartConnectionsConnectVerb.cs
- NamespaceInfo.cs
- ConfigurationSchemaErrors.cs
- ProfessionalColorTable.cs
- KeyedHashAlgorithm.cs
- ChtmlMobileTextWriter.cs
- updateconfighost.cs
- SevenBitStream.cs
- WorkflowTraceTransfer.cs
- MachinePropertyVariants.cs
- DispatchProxy.cs
- ScriptResourceInfo.cs
- Accessible.cs
- SettingsPropertyIsReadOnlyException.cs
- ComPlusTypeLoader.cs
- AspNetSynchronizationContext.cs