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
- RegistrySecurity.cs
- LifetimeManager.cs
- Stylesheet.cs
- PersonalizationStateInfoCollection.cs
- CodeTypeReference.cs
- ConstNode.cs
- ProcessHostConfigUtils.cs
- HwndKeyboardInputProvider.cs
- ScaleTransform3D.cs
- WinOEToolBoxItem.cs
- ObjectViewEntityCollectionData.cs
- WpfPayload.cs
- GifBitmapEncoder.cs
- MessageSmuggler.cs
- QueryableDataSourceHelper.cs
- View.cs
- DesignerHelpers.cs
- SessionStateItemCollection.cs
- View.cs
- ClientTargetCollection.cs
- HMAC.cs
- AppSettingsReader.cs
- SignatureHelper.cs
- Util.cs
- NetworkCredential.cs
- SqlMethodCallConverter.cs
- ZipIOModeEnforcingStream.cs
- QilPatternVisitor.cs
- AddInActivator.cs
- RawAppCommandInputReport.cs
- FacetDescription.cs
- ObjectPropertyMapping.cs
- IgnoreSectionHandler.cs
- Lasso.cs
- Script.cs
- NavigatingCancelEventArgs.cs
- WebPartUserCapability.cs
- EncoderParameters.cs
- PathSegment.cs
- Assert.cs
- WebBrowserSiteBase.cs
- RadioButtonList.cs
- _LoggingObject.cs
- ToolStripTemplateNode.cs
- DynamicDataRoute.cs
- ZoneLinkButton.cs
- XPathEmptyIterator.cs
- DataTableReader.cs
- Vector.cs
- RenderData.cs
- ConsoleEntryPoint.cs
- FormView.cs
- Keyboard.cs
- ScrollProviderWrapper.cs
- OdbcRowUpdatingEvent.cs
- PageThemeParser.cs
- SiteMapNodeItemEventArgs.cs
- ObjectListFieldCollection.cs
- SelectionListDesigner.cs
- TableColumnCollectionInternal.cs
- ToolBar.cs
- ListMarkerSourceInfo.cs
- DBConcurrencyException.cs
- SeverityFilter.cs
- TextCompositionManager.cs
- IPAddressCollection.cs
- JobPageOrder.cs
- AssemblyUtil.cs
- BulletChrome.cs
- ModelItemDictionary.cs
- XpsDocumentEvent.cs
- SortDescriptionCollection.cs
- XdrBuilder.cs
- ToolboxItemFilterAttribute.cs
- BindingExpressionUncommonField.cs
- SettingsBindableAttribute.cs
- DrawingAttributesDefaultValueFactory.cs
- ToolStripStatusLabel.cs
- StaticResourceExtension.cs
- ClientUrlResolverWrapper.cs
- DynamicExpression.cs
- DispatchWrapper.cs
- TimeoutValidationAttribute.cs
- SafeBitVector32.cs
- Literal.cs
- TimersDescriptionAttribute.cs
- AssertHelper.cs
- Int64Animation.cs
- safesecurityhelperavalon.cs
- RuntimeHandles.cs
- DataGridViewCell.cs
- SoapAttributeAttribute.cs
- brushes.cs
- NamespaceCollection.cs
- TypeUtils.cs
- WindowsTooltip.cs
- XamlHostingSectionGroup.cs
- MessageEncodingBindingElement.cs
- XmlLoader.cs
- XmlSchemaChoice.cs