Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / WinFormsIntegration / System / Windows / Automation / Peers / WindowsFormsHostAutomationPeer.cs / 1 / WindowsFormsHostAutomationPeer.cs
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using System.Windows.Forms.Integration;
using System.Security;
using System.Security.Permissions;
namespace System.Windows.Automation.Peers
{
///
public sealed class WindowsFormsHostAutomationPeer : FrameworkElementAutomationPeer
{
///
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public WindowsFormsHostAutomationPeer(WindowsFormsHost owner): base(owner)
{}
///
override protected string GetClassNameCore()
{
return "WindowsFormsHost";
}
///
override protected AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Pane;
}
///
override protected bool IsHwndHost { get { return true; }}
///
/// Critical - Calls critical HwndHost.Handle.
/// TreatAsSafe - This demands full trust, so it's safe
///
[SecurityCritical, SecurityTreatAsSafe]
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
override protected HostedWindowWrapper GetHostRawElementProviderCore()
{
HostedWindowWrapper host = null;
WindowsFormsHost wfh = (WindowsFormsHost)Owner;
IntPtr hwnd = wfh.Handle;
if(hwnd != IntPtr.Zero)
{
host = new HostedWindowWrapper(hwnd);
}
return host;
}
internal IRawElementProviderSimple GetProvider()
{
return ProviderFromPeer(this);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using System.Windows.Forms.Integration;
using System.Security;
using System.Security.Permissions;
namespace System.Windows.Automation.Peers
{
///
public sealed class WindowsFormsHostAutomationPeer : FrameworkElementAutomationPeer
{
///
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public WindowsFormsHostAutomationPeer(WindowsFormsHost owner): base(owner)
{}
///
override protected string GetClassNameCore()
{
return "WindowsFormsHost";
}
///
override protected AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Pane;
}
///
override protected bool IsHwndHost { get { return true; }}
///
/// Critical - Calls critical HwndHost.Handle.
/// TreatAsSafe - This demands full trust, so it's safe
///
[SecurityCritical, SecurityTreatAsSafe]
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
override protected HostedWindowWrapper GetHostRawElementProviderCore()
{
HostedWindowWrapper host = null;
WindowsFormsHost wfh = (WindowsFormsHost)Owner;
IntPtr hwnd = wfh.Handle;
if(hwnd != IntPtr.Zero)
{
host = new HostedWindowWrapper(hwnd);
}
return host;
}
internal IRawElementProviderSimple GetProvider()
{
return ProviderFromPeer(this);
}
}
}
// 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
- unsafenativemethodsother.cs
- ModelItemCollectionImpl.cs
- BaseCodePageEncoding.cs
- regiisutil.cs
- ImageSourceValueSerializer.cs
- MostlySingletonList.cs
- Scene3D.cs
- AsyncPostBackErrorEventArgs.cs
- BinaryExpression.cs
- Thickness.cs
- TrackingServices.cs
- WorkflowDesignerMessageFilter.cs
- _UncName.cs
- SspiSafeHandles.cs
- Path.cs
- RadioButtonList.cs
- SqlCachedBuffer.cs
- DataContract.cs
- MSAAWinEventWrap.cs
- EffectiveValueEntry.cs
- StartUpEventArgs.cs
- RadioButton.cs
- SignatureGenerator.cs
- PnrpPermission.cs
- BinaryFormatterSinks.cs
- FilteredAttributeCollection.cs
- __Error.cs
- LZCodec.cs
- RegexNode.cs
- CombinedGeometry.cs
- ThreadAbortException.cs
- Rfc2898DeriveBytes.cs
- AsymmetricKeyExchangeFormatter.cs
- Ops.cs
- DocumentAutomationPeer.cs
- RangeValuePatternIdentifiers.cs
- PenLineJoinValidation.cs
- SchemaCompiler.cs
- DataBindingList.cs
- MouseWheelEventArgs.cs
- TextAnchor.cs
- TextEditorThreadLocalStore.cs
- FontCacheLogic.cs
- ScrollChangedEventArgs.cs
- MachineKeySection.cs
- Stroke2.cs
- DrawingCollection.cs
- GacUtil.cs
- EmptyStringExpandableObjectConverter.cs
- ScrollPatternIdentifiers.cs
- RoleService.cs
- PenLineCapValidation.cs
- isolationinterop.cs
- Shared.cs
- dbenumerator.cs
- ConfigurationValidatorAttribute.cs
- MultilineStringConverter.cs
- ConfigurationException.cs
- TemplateApplicationHelper.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Color.cs
- XmlSchemaSimpleType.cs
- TaskHelper.cs
- CharAnimationUsingKeyFrames.cs
- EditBehavior.cs
- SystemInfo.cs
- MailSettingsSection.cs
- MonikerUtility.cs
- ContextMenuStrip.cs
- ThrowOnMultipleAssignment.cs
- DbConnectionPoolOptions.cs
- ContentElement.cs
- XamlFigureLengthSerializer.cs
- CertificateManager.cs
- SerializationSectionGroup.cs
- TreeViewItemAutomationPeer.cs
- ValidationSummary.cs
- SqlDataReaderSmi.cs
- ThemeInfoAttribute.cs
- SettingsAttributeDictionary.cs
- OutOfProcStateClientManager.cs
- PropertyChangedEventArgs.cs
- EffectiveValueEntry.cs
- TypeUtil.cs
- Bezier.cs
- InArgumentConverter.cs
- ObjectViewEntityCollectionData.cs
- IDQuery.cs
- OverflowException.cs
- TreeNodeStyle.cs
- EntityDesignPluralizationHandler.cs
- EventLogWatcher.cs
- DeclarativeCatalogPart.cs
- PointAnimationUsingPath.cs
- AsymmetricKeyExchangeDeformatter.cs
- BitmapEffectGeneralTransform.cs
- CounterCreationData.cs
- StringReader.cs
- OperatingSystem.cs
- ZipIOExtraFieldZip64Element.cs