Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- DependentList.cs
- ButtonColumn.cs
- EditCommandColumn.cs
- PackageRelationshipCollection.cs
- TcpConnectionPoolSettings.cs
- EntityDataSourceContainerNameItem.cs
- XamlToRtfWriter.cs
- FieldValue.cs
- UnrecognizedPolicyAssertionElement.cs
- MergeExecutor.cs
- TextBreakpoint.cs
- VerificationAttribute.cs
- XomlCompilerResults.cs
- XPathNodeHelper.cs
- RightsManagementEncryptedStream.cs
- IriParsingElement.cs
- CompoundFileIOPermission.cs
- _BasicClient.cs
- GradientBrush.cs
- PointKeyFrameCollection.cs
- CryptoApi.cs
- Duration.cs
- Repeater.cs
- GridViewSortEventArgs.cs
- WorkflowViewService.cs
- MinMaxParagraphWidth.cs
- Selection.cs
- IdnMapping.cs
- FilterableData.cs
- NavigationWindowAutomationPeer.cs
- ImageIndexConverter.cs
- PermissionRequestEvidence.cs
- WindowsToolbarAsMenu.cs
- OSFeature.cs
- QueryReaderSettings.cs
- RemoveStoryboard.cs
- XmlIncludeAttribute.cs
- TreeNodeStyle.cs
- TextMetrics.cs
- TextRangeAdaptor.cs
- LinqDataView.cs
- ListViewGroup.cs
- WebPartExportVerb.cs
- BindingExpressionBase.cs
- ObjectQueryProvider.cs
- ServiceReference.cs
- ControlDesignerState.cs
- SystemIcons.cs
- LoginDesignerUtil.cs
- ListViewSortEventArgs.cs
- EventWaitHandle.cs
- QilGeneratorEnv.cs
- cookie.cs
- PersonalizationAdministration.cs
- ButtonStandardAdapter.cs
- ExecutionScope.cs
- XmlHierarchicalDataSourceView.cs
- WsatConfiguration.cs
- _SSPISessionCache.cs
- LoginView.cs
- EventsTab.cs
- Action.cs
- StylusDownEventArgs.cs
- DynamicDocumentPaginator.cs
- RuleSettingsCollection.cs
- StreamMarshaler.cs
- HtmlProps.cs
- Hyperlink.cs
- SimpleWorkerRequest.cs
- ParentControlDesigner.cs
- InternalRelationshipCollection.cs
- DelegateSerializationHolder.cs
- BindingsCollection.cs
- Utilities.cs
- SecurityAlgorithmSuiteConverter.cs
- XmlCustomFormatter.cs
- StorageAssociationSetMapping.cs
- MarkupProperty.cs
- DefaultHttpHandler.cs
- Freezable.cs
- Config.cs
- DateTime.cs
- MDIControlStrip.cs
- ClientOptions.cs
- UnionCqlBlock.cs
- _HeaderInfoTable.cs
- QilScopedVisitor.cs
- CompilerGeneratedAttribute.cs
- ContextBase.cs
- RenamedEventArgs.cs
- ScrollChrome.cs
- KeyInstance.cs
- MethodSignatureGenerator.cs
- VirtualPathProvider.cs
- Matrix.cs
- OleDbError.cs
- XPathCompileException.cs
- AssociationEndMember.cs
- StringWriter.cs
- InputMethod.cs