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
- XmlElementAttribute.cs
- MultipartIdentifier.cs
- StateMachineDesignerPaint.cs
- SynchronizationLockException.cs
- BinaryUtilClasses.cs
- ProcessInfo.cs
- ResourceExpressionBuilder.cs
- QilNode.cs
- ReadOnlyDataSource.cs
- ValidatedControlConverter.cs
- GiveFeedbackEvent.cs
- ListViewDeletedEventArgs.cs
- Literal.cs
- ServicePointManagerElement.cs
- MetadataFile.cs
- SortExpressionBuilder.cs
- RSAPKCS1SignatureFormatter.cs
- WebPartVerbCollection.cs
- SelectionItemProviderWrapper.cs
- AutomationElement.cs
- SelectionUIHandler.cs
- Calendar.cs
- CodeSnippetExpression.cs
- DataSourceCache.cs
- MessageQueueException.cs
- WebPartZoneBase.cs
- XsdBuilder.cs
- ObjectConverter.cs
- ActivityExecutorSurrogate.cs
- LeaseManager.cs
- XPathNavigatorKeyComparer.cs
- WinHttpWebProxyFinder.cs
- WebBaseEventKeyComparer.cs
- IImplicitResourceProvider.cs
- ExpressionConverter.cs
- TrackingProfileSerializer.cs
- SqlWebEventProvider.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- SystemNetworkInterface.cs
- Visitors.cs
- GetUserPreferenceRequest.cs
- Helper.cs
- DataGridViewRowCollection.cs
- Soap.cs
- ObjectDataSourceStatusEventArgs.cs
- TreeIterators.cs
- EntityDataSourceContextCreatedEventArgs.cs
- Drawing.cs
- LookupBindingPropertiesAttribute.cs
- ControlDesigner.cs
- basevalidator.cs
- SqlProcedureAttribute.cs
- RequestCacheManager.cs
- HtmlShimManager.cs
- HtmlWindow.cs
- _KerberosClient.cs
- SendAgentStatusRequest.cs
- SaveFileDialog.cs
- BuildManager.cs
- HMACSHA384.cs
- ContextMenuAutomationPeer.cs
- BaseDataBoundControl.cs
- OdbcErrorCollection.cs
- CompatibleComparer.cs
- VersionPair.cs
- BindingMAnagerBase.cs
- oledbmetadatacollectionnames.cs
- DataGridState.cs
- DataGridrowEditEndingEventArgs.cs
- TextCompositionManager.cs
- PathData.cs
- OdbcRowUpdatingEvent.cs
- WebPartEditorApplyVerb.cs
- CodePageEncoding.cs
- TextTreePropertyUndoUnit.cs
- BitmapVisualManager.cs
- sqlcontext.cs
- StorageRoot.cs
- x509utils.cs
- ConfigurationStrings.cs
- cookieexception.cs
- MetafileHeaderWmf.cs
- ChoiceConverter.cs
- SqlCommandBuilder.cs
- AsyncPostBackErrorEventArgs.cs
- XmlSchemaProviderAttribute.cs
- MasterPageParser.cs
- WrappedOptions.cs
- AlgoModule.cs
- ConvertTextFrag.cs
- SvcFileManager.cs
- RelationshipType.cs
- PropertyDescriptor.cs
- OdbcEnvironmentHandle.cs
- QilParameter.cs
- FramingDecoders.cs
- CounterCreationData.cs
- XComponentModel.cs
- TdsParserSafeHandles.cs
- XPathPatternParser.cs