Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Interop / WindowInteropHelper.cs / 1 / WindowInteropHelper.cs
//---------------------------------------------------------------------------- // // File: WindowInteropHelper.cs // // Description: Implements Avalon WindowInteropHelper classes, which helps // interop b/w legacy and Avalon Window. // // Created: 05/06/03 // // Copyright (C) 2001 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Interop; using System.Security; using System.Security.Permissions; using System.Diagnostics; using MS.Internal; using MS.Internal.PresentationFramework; // SecurityHelper using MS.Win32; namespace System.Windows.Interop { #region class WindowInteropHelper ////// Implements Avalon WindowInteropHelper classes, which helps /// interop b/w legacy and Avalon Window. /// public sealed class WindowInteropHelper { //--------------------------------------------------- // // Constructors // //--------------------------------------------------- #region Constructors ////// /// /// public WindowInteropHelper(Window window) { if (window == null) throw new ArgumentNullException("window"); _window = window; } #endregion Constructors //---------------------------------------------------- // // Public Properties // //--------------------------------------------------- #region Public Properties ////// Get the Handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Handle { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); return CriticalHandle; } } ////// Critical: Exposes a handle /// internal IntPtr CriticalHandle { [SecurityCritical] get { Invariant.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.CriticalHandle; } } ////// Get/Set the Owner handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Owner { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.OwnerHandle; } [SecurityCritical] set { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); // error checking done in Window _window.OwnerHandle = value; } } #endregion Public Properties //---------------------------------------------- // // Private Fields // //---------------------------------------------- #region Private Fields private Window _window; #endregion Private Members } #endregion class WindowInteropHelper } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: WindowInteropHelper.cs // // Description: Implements Avalon WindowInteropHelper classes, which helps // interop b/w legacy and Avalon Window. // // Created: 05/06/03 // // Copyright (C) 2001 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Interop; using System.Security; using System.Security.Permissions; using System.Diagnostics; using MS.Internal; using MS.Internal.PresentationFramework; // SecurityHelper using MS.Win32; namespace System.Windows.Interop { #region class WindowInteropHelper ////// Implements Avalon WindowInteropHelper classes, which helps /// interop b/w legacy and Avalon Window. /// public sealed class WindowInteropHelper { //--------------------------------------------------- // // Constructors // //--------------------------------------------------- #region Constructors ////// /// /// public WindowInteropHelper(Window window) { if (window == null) throw new ArgumentNullException("window"); _window = window; } #endregion Constructors //---------------------------------------------------- // // Public Properties // //--------------------------------------------------- #region Public Properties ////// Get the Handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Handle { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); return CriticalHandle; } } ////// Critical: Exposes a handle /// internal IntPtr CriticalHandle { [SecurityCritical] get { Invariant.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.CriticalHandle; } } ////// Get/Set the Owner handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Owner { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.OwnerHandle; } [SecurityCritical] set { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); // error checking done in Window _window.OwnerHandle = value; } } #endregion Public Properties //---------------------------------------------- // // Private Fields // //---------------------------------------------- #region Private Fields private Window _window; #endregion Private Members } #endregion class WindowInteropHelper } // 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
- BigInt.cs
- ApplicationGesture.cs
- DataGridViewRowsAddedEventArgs.cs
- RadioButtonFlatAdapter.cs
- WindowsToolbar.cs
- RepeatButton.cs
- UserInitiatedNavigationPermission.cs
- CompatibleIComparer.cs
- HiddenField.cs
- ExpandSegment.cs
- ThreadStartException.cs
- RegisteredArrayDeclaration.cs
- MetaColumn.cs
- ClrProviderManifest.cs
- WebServiceMethodData.cs
- EventLogTraceListener.cs
- CollectionConverter.cs
- Policy.cs
- DuplicateContext.cs
- SinglePhaseEnlistment.cs
- FactoryMaker.cs
- PackageProperties.cs
- IndicShape.cs
- SecurityPolicySection.cs
- FlagPanel.cs
- SessionPageStateSection.cs
- UITypeEditors.cs
- CryptoKeySecurity.cs
- ObjectDataProvider.cs
- Rfc2898DeriveBytes.cs
- NameValueFileSectionHandler.cs
- FormViewModeEventArgs.cs
- PasswordPropertyTextAttribute.cs
- TextPenaltyModule.cs
- GridErrorDlg.cs
- ViewValidator.cs
- ReferentialConstraint.cs
- httpserverutility.cs
- PointHitTestParameters.cs
- ZipIOLocalFileHeader.cs
- DesignerLinkAdapter.cs
- ComplexPropertyEntry.cs
- CheckoutException.cs
- DateTimeUtil.cs
- ParserExtension.cs
- SizeAnimationUsingKeyFrames.cs
- COM2IProvidePropertyBuilderHandler.cs
- ValueQuery.cs
- PropertyInformation.cs
- RouteParametersHelper.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- DataGridViewTopRowAccessibleObject.cs
- MatrixAnimationUsingKeyFrames.cs
- TextBox.cs
- UnionCqlBlock.cs
- X509UI.cs
- IncomingWebRequestContext.cs
- DataGridViewRowConverter.cs
- embossbitmapeffect.cs
- Executor.cs
- XmlImplementation.cs
- TypographyProperties.cs
- WindowsClaimSet.cs
- CLSCompliantAttribute.cs
- NavigationProperty.cs
- CommonObjectSecurity.cs
- PkcsMisc.cs
- AccessText.cs
- RadioButtonBaseAdapter.cs
- ServiceModelActivationSectionGroup.cs
- HttpListenerRequest.cs
- SqlDataSourceFilteringEventArgs.cs
- Compiler.cs
- MimeXmlImporter.cs
- BrowserInteropHelper.cs
- CorePropertiesFilter.cs
- PeerCollaborationPermission.cs
- Events.cs
- Point3D.cs
- SpecialTypeDataContract.cs
- LinqDataSourceHelper.cs
- PaperSource.cs
- HttpConfigurationContext.cs
- TableAdapterManagerHelper.cs
- QueryResults.cs
- MouseBinding.cs
- LinkArea.cs
- FieldBuilder.cs
- DataGridCommandEventArgs.cs
- RemotingAttributes.cs
- AliasedSlot.cs
- TransformGroup.cs
- lengthconverter.cs
- PagedDataSource.cs
- EditorZone.cs
- Object.cs
- TypedElement.cs
- codemethodreferenceexpression.cs
- RC2.cs
- cookie.cs